diff options
Diffstat (limited to 'src/cli')
| -rw-r--r-- | src/cli/test_command.zig | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cli/test_command.zig b/src/cli/test_command.zig index a52af87c1..05b5d4058 100644 --- a/src/cli/test_command.zig +++ b/src/cli/test_command.zig @@ -478,7 +478,7 @@ pub const TestCommand = struct { if (reporter.summary.expectations > 0) Output.prettyError(" {d:5>} expect() calls\n", .{reporter.summary.expectations}); Output.prettyError( - \\ Ran {d} tests across {d} files + \\ Ran {d} tests across {d} files , .{ reporter.summary.fail + reporter.summary.pass, test_files.len, @@ -593,8 +593,8 @@ pub const TestCommand = struct { module.runTests(JSC.JSValue.zero, vm.global); vm.eventLoop().tick(); - const initial_unhandled_counter = vm.unhandled_error_counter; - while (vm.active_tasks > 0 and vm.unhandled_error_counter == initial_unhandled_counter) { + var prev_unhandled_count = vm.unhandled_error_counter; + while (vm.active_tasks > 0) { if (!jest.Jest.runner.?.has_pending_tests) jest.Jest.runner.?.drain(); vm.eventLoop().tick(); @@ -603,6 +603,11 @@ pub const TestCommand = struct { if (!jest.Jest.runner.?.has_pending_tests) break; vm.eventLoop().tick(); } + + while (prev_unhandled_count < vm.unhandled_error_counter) { + vm.global.handleRejectedPromises(); + prev_unhandled_count = vm.unhandled_error_counter; + } } _ = vm.global.vm().runGC(false); } |
