diff --git a/integration-tests/__tests__/__snapshots__/globals.test.js.snap b/integration-tests/__tests__/__snapshots__/globals.test.js.snap index 7318ba3ca0a3..f22d6698423b 100644 --- a/integration-tests/__tests__/__snapshots__/globals.test.js.snap +++ b/integration-tests/__tests__/__snapshots__/globals.test.js.snap @@ -32,7 +32,7 @@ exports[`cannot test with no implementation 1`] = ` | ^ 4 | test('test, no implementation'); 5 | - + at packages/jest-jasmine2/build/jasmine/Env.js:<>:<> at __tests__/only-constructs.test.js:<>:<> @@ -60,7 +60,7 @@ exports[`cannot test with no implementation with expand arg 1`] = ` | ^ 4 | test('test, no implementation'); 5 | - + at packages/jest-jasmine2/build/jasmine/Env.js:<>:<> at __tests__/only-constructs.test.js:<>:<> diff --git a/integration-tests/__tests__/globals.test.js b/integration-tests/__tests__/globals.test.js index 22a8e60f6041..ba3d5580e954 100644 --- a/integration-tests/__tests__/globals.test.js +++ b/integration-tests/__tests__/globals.test.js @@ -28,6 +28,12 @@ beforeEach(() => { afterAll(() => cleanup(DIR)); +// This function is needed due to differences between Node 6 and 8-9-10 when +// returning the result of the error. +function clean(text) { + return text.replace(/([\r\n])\s+(?=[\r\n])/g, '$1').replace(/\s+\^/g, ' ^'); +} + test('basic test constructs', () => { const filename = 'basic.test-constructs.test.js'; const content = ` @@ -123,8 +129,8 @@ test('cannot test with no implementation', () => { expect(status).toBe(1); const {summary, rest} = extractSummary(stderr, {stripLocation: true}); - expect(rest).toMatchSnapshot(); - expect(summary).toMatchSnapshot(); + expect(clean(rest)).toMatchSnapshot(); + expect(clean(summary)).toMatchSnapshot(); }); test('skips with expand arg', () => { @@ -201,8 +207,8 @@ test('cannot test with no implementation with expand arg', () => { expect(status).toBe(1); const {summary, rest} = extractSummary(stderr, {stripLocation: true}); - expect(rest).toMatchSnapshot(); - expect(summary).toMatchSnapshot(); + expect(clean(rest)).toMatchSnapshot(); + expect(clean(summary)).toMatchSnapshot(); }); test('function as descriptor', () => {