aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/test
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-03-28 18:23:50 -0700
committerGravatar GitHub <noreply@github.com> 2023-03-28 18:23:50 -0700
commitb76384351c55917692a9dc3b7f08f771a55b3fa1 (patch)
tree74a188ed15dac0f194e3e72fed4dd719ae4c601b /src/bun.js/test
parent0a914902269ebb1f5612385bd8b65aa1de4db71e (diff)
downloadbun-b76384351c55917692a9dc3b7f08f771a55b3fa1.tar.gz
bun-b76384351c55917692a9dc3b7f08f771a55b3fa1.tar.zst
bun-b76384351c55917692a9dc3b7f08f771a55b3fa1.zip
More bug fixes (#2486)
* readline_promises test fix * fix `escapeHTML` for baseline builds * fs test fixes, use `tmpdir()` * add paths for `resolve.test.js` * isError with toString symbol and error prototype * comment about `toString` * skip async macro transform * test cleanup, skip stack format test * readline undo and redo fix * capture error from readline keypress * Update tcp-server.test.ts * use `removefileat` for recursive rmdir * use strong for `signal.reason` * initialize `m_flags` * directory with file fs test * recursive option * import expect * could be less than * move abort signal tests to another process * fix typecheck --------- Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Diffstat (limited to 'src/bun.js/test')
-rw-r--r--src/bun.js/test/jest.zig12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bun.js/test/jest.zig b/src/bun.js/test/jest.zig
index 7aebf7e66..963a13967 100644
--- a/src/bun.js/test/jest.zig
+++ b/src/bun.js/test/jest.zig
@@ -2126,9 +2126,17 @@ pub const Expect = struct {
const result_: ?JSValue = brk: {
var vm = globalObject.bunVM();
+ var return_value: JSValue = .zero;
var scope = vm.unhandledRejectionScope();
- vm.onUnhandledRejection = &VirtualMachine.onQuietUnhandledRejectionHandler;
- const return_value: JSValue = value.call(globalObject, &.{});
+ var prev_unhandled_pending_rejection_to_capture = vm.unhandled_pending_rejection_to_capture;
+ vm.unhandled_pending_rejection_to_capture = &return_value;
+ vm.onUnhandledRejection = &VirtualMachine.onQuietUnhandledRejectionHandlerCaptureValue;
+ const return_value_from_fucntion: JSValue = value.call(globalObject, &.{});
+ vm.unhandled_pending_rejection_to_capture = prev_unhandled_pending_rejection_to_capture;
+
+ if (return_value == .zero) {
+ return_value = return_value_from_fucntion;
+ }
if (return_value.asAnyPromise()) |promise| {
globalObject.bunVM().waitForPromise(promise);