Skip to content

Commit

Permalink
test: fix test for node 6
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jan 3, 2018
1 parent 5843ab5 commit f902b4b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
20 changes: 10 additions & 10 deletions integration_tests/__tests__/__snapshots__/stack_trace.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,19 @@ exports[`works with custom matchers 1`] = `
qux
44 | const bar = () => baz();
45 | const baz = () => {
> 46 | throw Error('qux');
47 | };
48 |
49 | expect(() => {
43 | const bar = () => baz();
44 | const baz = () => {
> 45 | throw Error('qux');
46 | };
47 |
48 | // This expecation fails due to an error we throw (intentionally)
at __tests__/custom_matcher.test.js:46:13
at __tests__/custom_matcher.test.js:44:23
at __tests__/custom_matcher.test.js:45:13
at __tests__/custom_matcher.test.js:43:23
at __tests__/custom_matcher.test.js:50:7
at __tests__/custom_matcher.test.js:42:23
at __tests__/custom_matcher.test.js:52:7
at __tests__/custom_matcher.test.js:11:18
at __tests__/custom_matcher.test.js:51:8
at __tests__/custom_matcher.test.js:53:8
"
`;
7 changes: 6 additions & 1 deletion packages/jest-message-util/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ const ANONYMOUS_FN_IGNORE = /^\s+at <anonymous>.*$/;
const ANONYMOUS_PROMISE_IGNORE = /^\s+at (new )?Promise \(<anonymous>\).*$/;
const ANONYMOUS_GENERATOR_IGNORE = /^\s+at Generator.next \(<anonymous>\).*$/;
const NATIVE_NEXT_IGNORE = /^\s+at next \(native\).*$/;
const NATIVE_ERROR_IGNORE = /^\s+at Error \(native\).*$/;
const TITLE_INDENT = ' ';
const MESSAGE_INDENT = ' ';
const STACK_INDENT = ' ';
const ANCESTRY_SEPARATOR = ' \u203A ';
const TITLE_BULLET = chalk.bold('\u25cf ');
const STACK_TRACE_COLOR = chalk.dim;
const STACK_PATH_REGEXP = /\s*at.*\(?(\:\d*\:\d*|native)\)?/;
const STACK_PATH_REGEXP = /\s*at.*\(?(:\d*:\d*|native)\)?/;
const EXEC_ERROR_MESSAGE = 'Test suite failed to run';
const ERROR_TEXT = 'Error: ';

Expand Down Expand Up @@ -146,6 +147,10 @@ const removeInternalStackEntries = (lines, options: StackTraceOptions) => {
return false;
}

if (NATIVE_ERROR_IGNORE.test(line)) {
return false;
}

if (nodeInternals.some(internal => internal.test(line))) {
return false;
}
Expand Down

0 comments on commit f902b4b

Please sign in to comment.