Skip to content
/ jest Public
forked from jestjs/jest

Commit

Permalink
Fix snapshots (jestjs#6113)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjesun authored May 2, 2018
1 parent ffdca97 commit ae691b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:<<LINE>>:<<COLUMN>>
at __tests__/only-constructs.test.js:<<LINE>>:<<COLUMN>>
Expand Down Expand Up @@ -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:<<LINE>>:<<COLUMN>>
at __tests__/only-constructs.test.js:<<LINE>>:<<COLUMN>>
Expand Down
14 changes: 10 additions & 4 deletions integration-tests/__tests__/globals.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down

0 comments on commit ae691b1

Please sign in to comment.