Skip to content

Commit

Permalink
fix stack-trace when calling done with non-error (#6016)
Browse files Browse the repository at this point in the history
* fix stack-trace when calling `done`

* create Error in `fail` if not passed
  • Loading branch information
SimenB authored and cpojer committed Apr 18, 2018
1 parent fb356ac commit a36a69c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions integration-tests/__tests__/__snapshots__/failures.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,15 @@ exports[`not throwing Error objects 5`] = `
],
}
33 | });
34 |
> 35 | test('done(non-error)', done => {
| ^
36 | done(deepObject);
35 | test('done(non-error)', done => {
> 36 | done(deepObject);
| ^
37 | });
38 |
at packages/jest-jasmine2/build/jasmine/Spec.js:79:20
at __tests__/during_tests.test.js:35:1
at packages/jest-jasmine2/build/jasmine/Env.js:542:34
at __tests__/during_tests.test.js:36:3
"
`;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmine/Env.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ export default function(j$) {
expected: '',
actual: '',
message,
error: isError ? error : null,
error: isError ? error : new Error(message),
});
};
}
Expand Down

0 comments on commit a36a69c

Please sign in to comment.