Skip to content

Commit f902b4b

Browse files
committed
test: fix test for node 6
1 parent 5843ab5 commit f902b4b

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

integration_tests/__tests__/__snapshots__/stack_trace.test.js.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,19 @@ exports[`works with custom matchers 1`] = `
7474
7575
qux
7676
77-
44 | const bar = () => baz();
78-
45 | const baz = () => {
79-
> 46 | throw Error('qux');
80-
47 | };
81-
48 |
82-
49 | expect(() => {
77+
43 | const bar = () => baz();
78+
44 | const baz = () => {
79+
> 45 | throw Error('qux');
80+
46 | };
81+
47 |
82+
48 | // This expecation fails due to an error we throw (intentionally)
8383
84-
at __tests__/custom_matcher.test.js:46:13
85-
at __tests__/custom_matcher.test.js:44:23
84+
at __tests__/custom_matcher.test.js:45:13
8685
at __tests__/custom_matcher.test.js:43:23
87-
at __tests__/custom_matcher.test.js:50:7
86+
at __tests__/custom_matcher.test.js:42:23
87+
at __tests__/custom_matcher.test.js:52:7
8888
at __tests__/custom_matcher.test.js:11:18
89-
at __tests__/custom_matcher.test.js:51:8
89+
at __tests__/custom_matcher.test.js:53:8
9090
9191
"
9292
`;

packages/jest-message-util/src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ const ANONYMOUS_FN_IGNORE = /^\s+at <anonymous>.*$/;
5151
const ANONYMOUS_PROMISE_IGNORE = /^\s+at (new )?Promise \(<anonymous>\).*$/;
5252
const ANONYMOUS_GENERATOR_IGNORE = /^\s+at Generator.next \(<anonymous>\).*$/;
5353
const NATIVE_NEXT_IGNORE = /^\s+at next \(native\).*$/;
54+
const NATIVE_ERROR_IGNORE = /^\s+at Error \(native\).*$/;
5455
const TITLE_INDENT = ' ';
5556
const MESSAGE_INDENT = ' ';
5657
const STACK_INDENT = ' ';
5758
const ANCESTRY_SEPARATOR = ' \u203A ';
5859
const TITLE_BULLET = chalk.bold('\u25cf ');
5960
const STACK_TRACE_COLOR = chalk.dim;
60-
const STACK_PATH_REGEXP = /\s*at.*\(?(\:\d*\:\d*|native)\)?/;
61+
const STACK_PATH_REGEXP = /\s*at.*\(?(:\d*:\d*|native)\)?/;
6162
const EXEC_ERROR_MESSAGE = 'Test suite failed to run';
6263
const ERROR_TEXT = 'Error: ';
6364

@@ -146,6 +147,10 @@ const removeInternalStackEntries = (lines, options: StackTraceOptions) => {
146147
return false;
147148
}
148149

150+
if (NATIVE_ERROR_IGNORE.test(line)) {
151+
return false;
152+
}
153+
149154
if (nodeInternals.some(internal => internal.test(line))) {
150155
return false;
151156
}

0 commit comments

Comments
 (0)