Skip to content

Commit

Permalink
fix: add stacktrace to failed expect function call
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-abrioux committed Mar 29, 2022
1 parent b24da85 commit 3dba4e9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/test.js
Expand Up @@ -303,7 +303,12 @@ function wrapAssertFn(assertFn) {

return function(res) {
let badStack;
const err = assertFn(res);
let err;
try {
err = assertFn(res);
} catch (e) {
err = e;
}
if (err instanceof Error && err.stack) {
badStack = err.stack.replace(err.message, '').split('\n').slice(1);
err.stack = [err.toString()]
Expand Down

0 comments on commit 3dba4e9

Please sign in to comment.