diff options
author | 2022-11-07 04:49:10 -0800 | |
---|---|---|
committer | 2022-11-07 04:49:10 -0800 | |
commit | c00359a521bfcd0d1476511962cfc50763796e61 (patch) | |
tree | bda8c766e02080251394c33222d52fffe1af1380 /src/cli/test_command.zig | |
parent | 71d0e14210fb0fa1cd19c650dfd45e25dcafab98 (diff) | |
download | bun-c00359a521bfcd0d1476511962cfc50763796e61.tar.gz bun-c00359a521bfcd0d1476511962cfc50763796e61.tar.zst bun-c00359a521bfcd0d1476511962cfc50763796e61.zip |
[bun:test] Implement `done` callback with support for async functions
Diffstat (limited to 'src/cli/test_command.zig')
-rw-r--r-- | src/cli/test_command.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cli/test_command.zig b/src/cli/test_command.zig index 1927e6027..7b5c88947 100644 --- a/src/cli/test_command.zig +++ b/src/cli/test_command.zig @@ -482,10 +482,13 @@ pub const TestCommand = struct { var modules: []*Jest.DescribeScope = reporter.jest.files.items(.module_scope)[file_start..]; for (modules) |module| { + vm.onUnhandledRejectionCtx = null; + vm.onUnhandledRejection = Jest.TestRunnerTask.onUnhandledRejection; module.runTests(JSC.JSValue.zero, vm.global); vm.eventLoop().tick(); - while (vm.active_tasks > 0) { + const initial_unhandled_counter = vm.unhandled_error_counter; + while (vm.active_tasks > 0 and vm.unhandled_error_counter == initial_unhandled_counter) { if (!Jest.Jest.runner.?.has_pending_tests) Jest.Jest.runner.?.drain(); vm.eventLoop().tick(); |