Skip to content

Commit 182bdbb

Browse files
committed
guard against missing Error.captureStackTrace
1 parent 49ca96a commit 182bdbb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/expect/src/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,18 @@ const _validateResult = result => {
316316

317317
function assertions(expected: number) {
318318
const error = new Error();
319-
Error.captureStackTrace(error, assertions);
319+
if (Error.captureStackTrace) {
320+
Error.captureStackTrace(error, assertions);
321+
}
320322

321323
getState().expectedAssertionsNumber = expected;
322324
getState().expectedAssertionsNumberError = error;
323325
}
324326
function hasAssertions(expected: number) {
325327
const error = new Error();
326-
Error.captureStackTrace(error, hasAssertions);
328+
if (Error.captureStackTrace) {
329+
Error.captureStackTrace(error, hasAssertions);
330+
}
327331

328332
utils.ensureNoExpected(expected, '.hasAssertions');
329333
getState().isExpectingAssertions = true;

0 commit comments

Comments
 (0)