Skip to content

Commit bde2be1

Browse files
committed
No need to save return error of attempt twice
1 parent af598b7 commit bde2be1

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/test.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,7 @@ function tryTest(fn) {
9191
.forAttempt(t => fn.apply(null, [t].concat(args)))
9292
.run();
9393

94-
this.addPendingAttemptAssertion(running.then(ret => {
95-
if (!discarded && !ret.passed) {
96-
throw ret.error;
97-
}
98-
}));
94+
this.addPendingAttemptAssertion();
9995

10096
const finishedRunning = running.then(ret => {
10197
if (discarded) {
@@ -306,13 +302,12 @@ class Test {
306302
this.saveFirstError(error);
307303
}
308304

309-
addPendingAttemptAssertion(promise) {
305+
addPendingAttemptAssertion() {
310306
if (this.finishing) {
311307
this.saveFirstError(new Error('Assertion passed, but test has already finished'));
312308
}
313309

314310
this.pendingAttemptCount++;
315-
promise.catch(error => this.saveFirstError(error));
316311
}
317312

318313
decrementAttemptAssertion() {

0 commit comments

Comments
 (0)