Skip to content

Commit 3dba4e9

Browse files
committedMar 29, 2022
fix: add stacktrace to failed expect function call
1 parent b24da85 commit 3dba4e9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

Diff for: ‎lib/test.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,12 @@ function wrapAssertFn(assertFn) {
303303

304304
return function(res) {
305305
let badStack;
306-
const err = assertFn(res);
306+
let err;
307+
try {
308+
err = assertFn(res);
309+
} catch (e) {
310+
err = e;
311+
}
307312
if (err instanceof Error && err.stack) {
308313
badStack = err.stack.replace(err.message, '').split('\n').slice(1);
309314
err.stack = [err.toString()]

0 commit comments

Comments
 (0)
Please sign in to comment.