Skip to content

Commit

Permalink
Fix test for node 9
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Nov 8, 2017
1 parent 83513ff commit 99f79dd
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion integration_tests/__tests__/failures.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,37 @@ test('not throwing Error objects', () => {

test('works with node assert', () => {
const {stderr} = runJest(dir, ['node_assertion_error.test.js']);
expect(normalizeDots(extractSummary(stderr).rest)).toMatchSnapshot();
let summary = normalizeDots(extractSummary(stderr).rest);

// Node 9 started to include the error for `doesNotThrow`
// https://github.com/nodejs/node/pull/12167
if (process.versions.node.split('.')[0] >= 9) {
expect(summary).toContain(`
assert.doesNotThrow(function)
Expected the function not to throw an error.
Instead, it threw:
[Error: err!]
Message:
Got unwanted exception.
err!
err!
at __tests__/node_assertion_error.test.js:71:10
`);

summary = summary.replace(
`Message:
Got unwanted exception.
err!
err!
`,
`Message:
Got unwanted exception.
`,
);
}

expect(summary).toMatchSnapshot();
});

0 comments on commit 99f79dd

Please sign in to comment.