aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/test/jest.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bun.js/test/jest.zig b/src/bun.js/test/jest.zig
index 8674e2c22..e33e0fbf2 100644
--- a/src/bun.js/test/jest.zig
+++ b/src/bun.js/test/jest.zig
@@ -1070,6 +1070,11 @@ pub const TestRunnerTask = struct {
this.sync_state = .pending;
const result = TestScope.run(&test_, this);
+
+ // rejected promises should fail the test
+ if (result != .fail)
+ globalThis.handleRejectedPromises();
+
if (result == .pending and this.sync_state == .pending and (this.done_callback_state == .pending or this.promise_state == .pending)) {
this.sync_state = .fulfilled;
this.value.set(globalThis, this.describe.value);
@@ -1078,6 +1083,10 @@ pub const TestRunnerTask = struct {
this.handleResult(result, .sync);
+ if (result == .fail) {
+ globalThis.handleRejectedPromises();
+ }
+
return false;
}