Remove expected and actual properties of expectation results
This commit is contained in:
@@ -6,20 +6,11 @@ getJasmineRequireObj().buildExpectationResult = function(j$) {
|
||||
/**
|
||||
* Describes the result of evaluating an expectation
|
||||
*
|
||||
* 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. jasmine-browser-runner 3.0 and
|
||||
* later omits them entirely.
|
||||
*
|
||||
* @typedef ExpectationResult
|
||||
* @property {String} matcherName - The name of the matcher that was executed for this expectation.
|
||||
* @property {String} message - The failure message for the expectation.
|
||||
* @property {String} stack - The stack trace for the failure if available.
|
||||
* @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.
|
||||
* @property {String|undefined} globalErrorType - The type of an error that
|
||||
* is reported on the top suite. Valid values are undefined, "afterAll",
|
||||
* "load", "lateExpectation", and "lateError".
|
||||
@@ -32,21 +23,12 @@ getJasmineRequireObj().buildExpectationResult = function(j$) {
|
||||
};
|
||||
|
||||
if (!result.passed) {
|
||||
result.expected = options.expected;
|
||||
result.actual = options.actual;
|
||||
|
||||
if (options.error && !j$.isString_(options.error)) {
|
||||
if ('code' in options.error) {
|
||||
result.code = options.error.code;
|
||||
}
|
||||
|
||||
if (
|
||||
options.error.code === 'ERR_ASSERTION' &&
|
||||
options.expected === '' &&
|
||||
options.actual === ''
|
||||
) {
|
||||
result.expected = options.error.expected;
|
||||
result.actual = options.error.actual;
|
||||
if (options.error.code === 'ERR_ASSERTION') {
|
||||
result.matcherName = 'assert ' + options.error.operator;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user