Skip to content

Commit c023e26

Browse files
authored
Handle empty stack (#15792)
1 parent 85012bd commit c023e26

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/jest-circus/src/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,9 @@ const _getError = (
439439
};
440440

441441
const getErrorStack = (error: Error): string =>
442-
typeof error.stack === 'string' ? error.stack : error.message;
442+
typeof error.stack === 'string' && error.stack !== ''
443+
? error.stack
444+
: error.message;
443445

444446
export const addErrorToEachTestUnderDescribe = (
445447
describeBlock: Circus.DescribeBlock,

0 commit comments

Comments
 (0)