Skip to content

Commit

Permalink
wrap snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
ychi committed Apr 23, 2020
1 parent 4873bd2 commit 216971c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ exports[`formatStackTrace should strip node internals 1`] = `
`;
exports[`getConsoleOutput does not print code frame when noCodeFrame = true 1`] = `
"
<dim>at Object.<anonymous> (</>file.js<dim>:1:7)</>
"
[2mat Object.<anonymous> ([22mfile.js[2m:1:7)[22m
`;
exports[`getConsoleOutput does not print codeframe when noStackTrace = true 1`] = `
"
<dim>at Object.<anonymous> (</>file.js<dim>:1:7)</>
"
[2mat Object.<anonymous> ([22mfile.js[2m:1:7)[22m
`;
exports[`getConsoleOutput prints code frame and stacktrace 1`] = `
"
</><red><bold>></></><gray> 1 | </><cyan>throw</> <cyan>new</> <yellow>Error</>(<green>\\"Whoops!\\"</>)<yellow>;</></>
</> <gray> | </> <red><bold>^</></></>
<dim>at Object.<anonymous> (</>file.js<dim>:1:7)</>
"
> 1 | throw new Error("Whoops!");
  |  ^
at Object.<anonymous> (file.js:1:7)
`;
exports[`no codeframe 1`] = `
Expand Down
7 changes: 4 additions & 3 deletions packages/jest-message-util/src/__tests__/messages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import {readFileSync} from 'fs';
import slash = require('slash');
import tempy = require('tempy');
import {wrap} from 'jest-snapshot-serializer-raw';
import {formatExecError, formatResultsErrors, formatStackTrace} from '..';

const rootDir = tempy.directory();
Expand Down Expand Up @@ -313,7 +314,7 @@ describe('getConsoleOutput', () => {
'path_test',
);

expect(message).toMatchSnapshot();
expect(wrap(message)).toMatchSnapshot();
});

it('does not print code frame when noCodeFrame = true', () => {
Expand All @@ -338,7 +339,7 @@ describe('getConsoleOutput', () => {
'path_test',
);

expect(message).toMatchSnapshot();
expect(wrap(message)).toMatchSnapshot();
});

it('does not print codeframe when noStackTrace = true', () => {
Expand All @@ -362,6 +363,6 @@ describe('getConsoleOutput', () => {
'path_test',
);

expect(message).toMatchSnapshot();
expect(wrap(message)).toMatchSnapshot();
});
});

0 comments on commit 216971c

Please sign in to comment.