Removed remaining paths that pass expected and actual of expectations to reporters

This commit is contained in:
Steve Gravrock
2025-09-20 16:14:54 -07:00
parent 7aaa16f576
commit 1e98a4b61b
8 changed files with 7 additions and 101 deletions

View File

@@ -922,8 +922,6 @@ getJasmineRequireObj().Spec = function(j$) {
{
matcherName: '',
passed: false,
expected: '',
actual: '',
error: e
},
true
@@ -1286,23 +1284,13 @@ getJasmineRequireObj().Env = function(j$) {
* {@link throwUnless}. Properties of this error are a subset of the
* properties of {@link ExpectationResult} and have the same values.
*
* Note: The expected and actual properties are deprecated and may be removed
* in a future release. In many Jasmine configurations they are passed
* through JSON serialization and deserialization, which is inherently
* lossy. In such cases, the expected and actual values may be placeholders
* or approximations of the original objects.
*
* @property {String} matcherName - The name of the matcher that was executed for this expectation.
* @property {String} message - The failure message for the expectation.
* @property {Boolean} passed - Whether the expectation passed or failed.
* @property {Object} expected - Deprecated. If the expectation failed, what was the expected value.
* @property {Object} actual - Deprecated. If the expectation failed, what actual value was produced.
*/
const error = new Error(result.message);
error.passed = result.passed;
error.message = result.message;
error.expected = result.expected;
error.actual = result.actual;
error.matcherName = result.matcherName;
throw error;
}
@@ -4345,9 +4333,7 @@ getJasmineRequireObj().Expector = function(j$) {
passed: result.pass,
message: message,
error: errorForStack ? undefined : result.error,
errorForStack: errorForStack || undefined,
actual: this.actual,
expected: this.expected // TODO: this may need to be arrayified/sliced
errorForStack: errorForStack || undefined
});
};
@@ -10720,8 +10706,6 @@ getJasmineRequireObj().Suite = function(j$) {
const data = {
matcherName: '',
passed: false,
expected: '',
actual: '',
error: arguments[0]
};
const failedExpectation = j$.buildExpectationResult(data);

View File

@@ -303,8 +303,6 @@ describe('AsyncExpectation', function() {
passed: true,
message: '',
error: undefined,
expected: 'hello',
actual: 'an actual',
errorForStack: jasmine.any(Error)
});
});
@@ -338,8 +336,6 @@ describe('AsyncExpectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: '',
error: undefined,
errorForStack: jasmine.any(Error)
@@ -372,8 +368,6 @@ describe('AsyncExpectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: 'I am a custom message',
error: undefined,
errorForStack: jasmine.any(Error)
@@ -408,8 +402,6 @@ describe('AsyncExpectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: 'I am a custom message',
error: undefined,
errorForStack: jasmine.any(Error)
@@ -428,7 +420,6 @@ describe('AsyncExpectation', function() {
}
};
const addExpectationResult = jasmine.createSpy('addExpectationResult');
const actual = 'an actual';
const expectation = jasmineUnderTest.Expectation.asyncFactory({
customAsyncMatchers: matchers,
@@ -442,8 +433,6 @@ describe('AsyncExpectation', function() {
passed: true,
message: '',
error: undefined,
expected: 'hello',
actual: actual,
errorForStack: jasmine.any(Error)
});
});
@@ -465,7 +454,6 @@ describe('AsyncExpectation', function() {
}
};
const addExpectationResult = jasmine.createSpy('addExpectationResult');
const actual = 'an actual';
const expectation = jasmineUnderTest.Expectation.asyncFactory({
customAsyncMatchers: matchers,
@@ -478,8 +466,6 @@ describe('AsyncExpectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: actual,
message: 'default message',
error: undefined,
errorForStack: jasmine.any(Error)
@@ -501,7 +487,6 @@ describe('AsyncExpectation', function() {
}
};
const addExpectationResult = jasmine.createSpy('addExpectationResult');
const actual = 'an actual';
const expectation = jasmineUnderTest.Expectation.asyncFactory({
customAsyncMatchers: matchers,
@@ -513,8 +498,6 @@ describe('AsyncExpectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: actual,
message: 'I am a custom message',
error: undefined,
errorForStack: jasmine.any(Error)
@@ -536,7 +519,6 @@ describe('AsyncExpectation', function() {
}
};
const addExpectationResult = jasmine.createSpy('addExpectationResult');
const actual = 'an actual';
const expectation = jasmineUnderTest.Expectation.asyncFactory({
customAsyncMatchers: matchers,
@@ -548,8 +530,6 @@ describe('AsyncExpectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(true, {
matcherName: 'toFoo',
passed: true,
expected: 'hello',
actual: actual,
message: '',
error: undefined,
errorForStack: jasmine.any(Error)
@@ -574,7 +554,6 @@ describe('AsyncExpectation', function() {
}
};
const addExpectationResult = jasmine.createSpy('addExpectationResult');
const actual = 'an actual';
const expectation = jasmineUnderTest.Expectation.asyncFactory({
customAsyncMatchers: matchers,
@@ -586,8 +565,6 @@ describe('AsyncExpectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: actual,
message: "I'm a custom message",
error: undefined,
errorForStack: jasmine.any(Error)
@@ -622,8 +599,6 @@ describe('AsyncExpectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: 'I am a custom message',
error: undefined,
errorForStack: jasmine.any(Error)
@@ -656,8 +631,6 @@ describe('AsyncExpectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: 'I am a custom message',
error: undefined,
errorForStack: jasmine.any(Error)
@@ -692,8 +665,6 @@ describe('AsyncExpectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: 'I am a custom message',
error: undefined,
errorForStack: jasmine.any(Error)

View File

@@ -108,8 +108,6 @@ describe('Expectation', function() {
passed: true,
message: '',
error: undefined,
expected: 'hello',
actual: 'an actual',
errorForStack: undefined
});
});
@@ -143,8 +141,6 @@ describe('Expectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: '',
error: undefined,
errorForStack: undefined
@@ -177,8 +173,6 @@ describe('Expectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: 'I am a custom message',
error: undefined,
errorForStack: undefined
@@ -213,8 +207,6 @@ describe('Expectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: 'I am a custom message',
error: undefined,
errorForStack: undefined
@@ -231,8 +223,7 @@ describe('Expectation', function() {
};
}
},
addExpectationResult = jasmine.createSpy('addExpectationResult'),
actual = 'an actual';
addExpectationResult = jasmine.createSpy('addExpectationResult');
const expectation = jasmineUnderTest.Expectation.factory({
customMatchers: matchers,
@@ -247,8 +238,6 @@ describe('Expectation', function() {
passed: true,
message: '',
error: undefined,
expected: 'hello',
actual: actual,
errorForStack: undefined
});
});
@@ -268,8 +257,7 @@ describe('Expectation', function() {
return 'default message';
}
},
addExpectationResult = jasmine.createSpy('addExpectationResult'),
actual = 'an actual';
addExpectationResult = jasmine.createSpy('addExpectationResult');
const expectation = jasmineUnderTest.Expectation.factory({
customMatchers: matchers,
@@ -283,8 +271,6 @@ describe('Expectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: actual,
message: 'default message',
error: undefined,
errorForStack: undefined
@@ -304,8 +290,7 @@ describe('Expectation', function() {
};
}
},
addExpectationResult = jasmine.createSpy('addExpectationResult'),
actual = 'an actual';
addExpectationResult = jasmine.createSpy('addExpectationResult');
const expectation = jasmineUnderTest.Expectation.factory({
customMatchers: matchers,
@@ -318,8 +303,6 @@ describe('Expectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: actual,
message: 'I am a custom message',
error: undefined,
errorForStack: undefined
@@ -339,8 +322,7 @@ describe('Expectation', function() {
};
}
},
addExpectationResult = jasmine.createSpy('addExpectationResult'),
actual = 'an actual';
addExpectationResult = jasmine.createSpy('addExpectationResult');
const expectation = jasmineUnderTest.Expectation.factory({
customMatchers: matchers,
@@ -353,8 +335,6 @@ describe('Expectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(true, {
matcherName: 'toFoo',
passed: true,
expected: 'hello',
actual: actual,
message: '',
error: undefined,
errorForStack: undefined
@@ -377,8 +357,7 @@ describe('Expectation', function() {
};
}
},
addExpectationResult = jasmine.createSpy('addExpectationResult'),
actual = 'an actual';
addExpectationResult = jasmine.createSpy('addExpectationResult');
const expectation = jasmineUnderTest.Expectation.factory({
customMatchers: matchers,
@@ -391,8 +370,6 @@ describe('Expectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: actual,
message: "I'm a custom message",
error: undefined,
errorForStack: undefined
@@ -427,8 +404,6 @@ describe('Expectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: 'I am a custom message',
error: customError,
errorForStack: undefined
@@ -463,8 +438,6 @@ describe('Expectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: 'I am a custom message',
error: customError,
errorForStack: undefined
@@ -501,8 +474,6 @@ describe('Expectation', function() {
expect(addExpectationResult).toHaveBeenCalledWith(false, {
matcherName: 'toFoo',
passed: false,
expected: 'hello',
actual: 'an actual',
message: 'I am a custom message',
error: customError,
errorForStack: undefined

View File

@@ -3702,8 +3702,6 @@ describe('Env integration', function() {
expect(thrown.passed).toEqual(false);
expect(thrown.matcherName).toEqual('toEqual');
expect(thrown.message).toEqual('Expected 1 to equal 2.');
expect(thrown.actual).toEqual(1);
expect(thrown.expected).toEqual(2);
});
it('does not throw when the matcher passes', async function() {
@@ -3760,8 +3758,6 @@ describe('Env integration', function() {
expect(thrown.message).toEqual(
"Expected a promise to be resolved to 'b' but it was resolved to 'a'."
);
expect(thrown.actual).toBe(promise);
expect(thrown.expected).toEqual('b');
});
it('does not throw when the matcher passes', async function() {

View File

@@ -158,23 +158,13 @@ getJasmineRequireObj().Env = function(j$) {
* {@link throwUnless}. Properties of this error are a subset of the
* properties of {@link ExpectationResult} and have the same values.
*
* Note: The expected and actual properties are deprecated and may be removed
* in a future release. In many Jasmine configurations they are passed
* through JSON serialization and deserialization, which is inherently
* lossy. In such cases, the expected and actual values may be placeholders
* or approximations of the original objects.
*
* @property {String} matcherName - The name of the matcher that was executed for this expectation.
* @property {String} message - The failure message for the expectation.
* @property {Boolean} passed - Whether the expectation passed or failed.
* @property {Object} expected - Deprecated. If the expectation failed, what was the expected value.
* @property {Object} actual - Deprecated. If the expectation failed, what actual value was produced.
*/
const error = new Error(result.message);
error.passed = result.passed;
error.message = result.message;
error.expected = result.expected;
error.actual = result.actual;
error.matcherName = result.matcherName;
throw error;
}

View File

@@ -83,9 +83,7 @@ getJasmineRequireObj().Expector = function(j$) {
passed: result.pass,
message: message,
error: errorForStack ? undefined : result.error,
errorForStack: errorForStack || undefined,
actual: this.actual,
expected: this.expected // TODO: this may need to be arrayified/sliced
errorForStack: errorForStack || undefined
});
};

View File

@@ -148,8 +148,6 @@ getJasmineRequireObj().Spec = function(j$) {
{
matcherName: '',
passed: false,
expected: '',
actual: '',
error: e
},
true

View File

@@ -183,8 +183,6 @@ getJasmineRequireObj().Suite = function(j$) {
const data = {
matcherName: '',
passed: false,
expected: '',
actual: '',
error: arguments[0]
};
const failedExpectation = j$.buildExpectationResult(data);