diff --git a/e2e/__tests__/__snapshots__/failures.test.ts.snap b/e2e/__tests__/__snapshots__/failures.test.ts.snap index 4a3f562eb25f..14c7531a152b 100644 --- a/e2e/__tests__/__snapshots__/failures.test.ts.snap +++ b/e2e/__tests__/__snapshots__/failures.test.ts.snap @@ -493,39 +493,36 @@ exports[`works with error with cause 1`] = ` `; exports[`works with error with cause thrown outside tests 1`] = ` -"FAIL __tests__/errorWithCauseInDescribe.test.js - ● Test suite failed to run - - error during f - - 10 | - 11 | function buildErrorWithCause(message: string, opts: {cause: unknown}): Error { - > 12 | const error = new Error(message, opts); - | ^ - 13 | if (opts.cause !== error.cause) { - 14 | // Error with cause not supported in legacy versions of node, we just polyfill it - 15 | Object.assign(error, opts); - - at buildErrorWithCause (__tests__/errorWithCauseInDescribe.test.js:12:17) - at buildErrorWithCause (__tests__/errorWithCauseInDescribe.test.js:27:11) - at f (__tests__/errorWithCauseInDescribe.test.js:32:3) - at Object.describe (__tests__/errorWithCauseInDescribe.test.js:31:1) - - Cause: - error during g - - 19 | - 20 | function g() { - > 21 | throw new Error('error during g'); - | ^ - 22 | } - 23 | function f() { - 24 | try { - - at g (__tests__/errorWithCauseInDescribe.test.js:21:9) - at g (__tests__/errorWithCauseInDescribe.test.js:25:5) - at f (__tests__/errorWithCauseInDescribe.test.js:32:3) - at Object.describe (__tests__/errorWithCauseInDescribe.test.js:31:1)" +"error during f + +10 | +11 | function buildErrorWithCause(message: string, opts: {cause: unknown}): Error { +> 12 | const error = new Error(message, opts); +| ^ +13 | if (opts.cause !== error.cause) { +14 | // Error with cause not supported in legacy versions of node, we just polyfill it +15 | Object.assign(error, opts); + +at buildErrorWithCause (__tests__/errorWithCauseInDescribe.test.js:12:17) +at buildErrorWithCause (__tests__/errorWithCauseInDescribe.test.js:27:11) +at f (__tests__/errorWithCauseInDescribe.test.js:32:3) +at Object.describe (__tests__/errorWithCauseInDescribe.test.js:31:1) + +Cause: +error during g + +19 | +20 | function g() { +> 21 | throw new Error('error during g'); +| ^ +22 | } +23 | function f() { +24 | try { + +at g (__tests__/errorWithCauseInDescribe.test.js:21:9) +at g (__tests__/errorWithCauseInDescribe.test.js:25:5) +at f (__tests__/errorWithCauseInDescribe.test.js:32:3) +at Object.describe (__tests__/errorWithCauseInDescribe.test.js:31:1)" `; exports[`works with node assert 1`] = ` diff --git a/e2e/__tests__/failures.test.ts b/e2e/__tests__/failures.test.ts index 7ec2e26924c4..5179cc171f77 100644 --- a/e2e/__tests__/failures.test.ts +++ b/e2e/__tests__/failures.test.ts @@ -100,8 +100,17 @@ test('works with error with cause', () => { test('works with error with cause thrown outside tests', () => { const {stderr} = runJest(dir, ['errorWithCauseInDescribe.test.js']); const summary = normalizeDots(cleanStderr(stderr)); + const sanitizedSummary = summary + .replace(/ Suite\.f /g, ' f ') // added by jasmine runner + .split('\n') + .map(line => line.trim()) // jasmine runner does not come with the same indentation + .join('\n'); - expect(summary).toMatchSnapshot(); + expect( + // jasmine runner differ from circus one in this case, we just start + // the comparison when the stack starts to be reported + sanitizedSummary.substring(sanitizedSummary.indexOf('error during f')), + ).toMatchSnapshot(); }); test('errors after test has completed', () => {