Don't leak errorWithStack in late async expectation failures
This commit is contained in:
@@ -1354,7 +1354,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
'2. Was done() invoked before an async operation completed?\n' +
|
'2. Was done() invoked before an async operation completed?\n' +
|
||||||
'3. Did an expectation follow a call to done()?';
|
'3. Did an expectation follow a call to done()?';
|
||||||
|
|
||||||
topSuite.result.failedExpectations.push(delayedExpectationResult);
|
topSuite.addExpectationResult(false, delayedExpectationResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
function routeLateFailure(expectationResult) {
|
function routeLateFailure(expectationResult) {
|
||||||
@@ -2527,7 +2527,8 @@ getJasmineRequireObj().buildExpectationResult = function(j$) {
|
|||||||
matcherName: options.matcherName,
|
matcherName: options.matcherName,
|
||||||
message: message(),
|
message: message(),
|
||||||
stack: options.omitStackTrace ? '' : stack(),
|
stack: options.omitStackTrace ? '' : stack(),
|
||||||
passed: options.passed
|
passed: options.passed,
|
||||||
|
globalErrorType: options.globalErrorType
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!result.passed) {
|
if (!result.passed) {
|
||||||
@@ -8620,7 +8621,7 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const thisEvent = j$.util.clone(event);
|
const thisEvent = structuredClone(event);
|
||||||
if (fn.length <= 1) {
|
if (fn.length <= 1) {
|
||||||
fns.push({
|
fns.push({
|
||||||
fn: function() {
|
fn: function() {
|
||||||
|
|||||||
@@ -337,7 +337,8 @@ describe('Spec', function() {
|
|||||||
message: 'foo thrown',
|
message: 'foo thrown',
|
||||||
matcherName: '',
|
matcherName: '',
|
||||||
passed: false,
|
passed: false,
|
||||||
stack: null
|
stack: null,
|
||||||
|
globalErrorType: undefined
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1674,7 +1674,13 @@ describe('Env integration', function() {
|
|||||||
status: 'passed',
|
status: 'passed',
|
||||||
parentSuiteId: suiteFullNameToId['A Suite'],
|
parentSuiteId: suiteFullNameToId['A Suite'],
|
||||||
passedExpectations: [
|
passedExpectations: [
|
||||||
{ matcherName: 'toBe', message: 'Passed.', stack: '', passed: true }
|
{
|
||||||
|
matcherName: 'toBe',
|
||||||
|
message: 'Passed.',
|
||||||
|
stack: '',
|
||||||
|
passed: true,
|
||||||
|
globalErrorType: undefined
|
||||||
|
}
|
||||||
],
|
],
|
||||||
duration: jasmine.any(Number)
|
duration: jasmine.any(Number)
|
||||||
});
|
});
|
||||||
@@ -3145,7 +3151,7 @@ describe('Env integration', function() {
|
|||||||
|
|
||||||
const result = jasmineDone.calls.argsFor(0)[0];
|
const result = jasmineDone.calls.argsFor(0)[0];
|
||||||
expect(result.failedExpectations).toEqual([
|
expect(result.failedExpectations).toEqual([
|
||||||
jasmine.objectContaining({
|
{
|
||||||
passed: false,
|
passed: false,
|
||||||
globalErrorType: 'lateExpectation',
|
globalErrorType: 'lateExpectation',
|
||||||
message:
|
message:
|
||||||
@@ -3154,8 +3160,9 @@ describe('Env integration', function() {
|
|||||||
'1. Did you forget to return or await the result of expectAsync?\n' +
|
'1. Did you forget to return or await the result of expectAsync?\n' +
|
||||||
'2. Was done() invoked before an async operation completed?\n' +
|
'2. Was done() invoked before an async operation completed?\n' +
|
||||||
'3. Did an expectation follow a call to done()?',
|
'3. Did an expectation follow a call to done()?',
|
||||||
matcherName: 'toBeResolved'
|
matcherName: 'toBeResolved',
|
||||||
})
|
stack: jasmine.any(String)
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
'2. Was done() invoked before an async operation completed?\n' +
|
'2. Was done() invoked before an async operation completed?\n' +
|
||||||
'3. Did an expectation follow a call to done()?';
|
'3. Did an expectation follow a call to done()?';
|
||||||
|
|
||||||
topSuite.result.failedExpectations.push(delayedExpectationResult);
|
topSuite.addExpectationResult(false, delayedExpectationResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
function routeLateFailure(expectationResult) {
|
function routeLateFailure(expectationResult) {
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ getJasmineRequireObj().buildExpectationResult = function(j$) {
|
|||||||
matcherName: options.matcherName,
|
matcherName: options.matcherName,
|
||||||
message: message(),
|
message: message(),
|
||||||
stack: options.omitStackTrace ? '' : stack(),
|
stack: options.omitStackTrace ? '' : stack(),
|
||||||
passed: options.passed
|
passed: options.passed,
|
||||||
|
globalErrorType: options.globalErrorType
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!result.passed) {
|
if (!result.passed) {
|
||||||
|
|||||||
Reference in New Issue
Block a user