aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/javascript.zig
diff options
context:
space:
mode:
authorGravatar Ashcon Partovi <ashcon@partovi.net> 2023-06-22 22:27:00 -0700
committerGravatar GitHub <noreply@github.com> 2023-06-22 22:27:00 -0700
commit217501e180eadd1999f30733e0f13580cd1f0abf (patch)
tree998ceabbe1000bd96a740659163c2aff104f1190 /src/bun.js/javascript.zig
parentae4b65c52e04850f45b73dc1c7d7aa8524a9a7bd (diff)
downloadbun-217501e180eadd1999f30733e0f13580cd1f0abf.tar.gz
bun-217501e180eadd1999f30733e0f13580cd1f0abf.tar.zst
bun-217501e180eadd1999f30733e0f13580cd1f0abf.zip
`expect().resolves` and `expect().rejects` (#3318)
* Move expect and snapshots to their own files * expect().resolves and expect().rejects * Fix promise being added to unhandled rejection list * Handle timeouts in expect(<promise>) * wip merge * Fix merge issue --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/javascript.zig')
-rw-r--r--src/bun.js/javascript.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig
index 545f41f19..bebfbeb18 100644
--- a/src/bun.js/javascript.zig
+++ b/src/bun.js/javascript.zig
@@ -653,6 +653,10 @@ pub const VirtualMachine = struct {
this.eventLoop().waitForPromise(promise);
}
+ pub fn waitForPromiseWithTimeout(this: *VirtualMachine, promise: JSC.AnyPromise, timeout: u32) bool {
+ return this.eventLoop().waitForPromiseWithTimeout(promise, timeout);
+ }
+
pub fn waitForTasks(this: *VirtualMachine) void {
this.eventLoop().waitForTasks();
}
@@ -957,6 +961,7 @@ pub const VirtualMachine = struct {
}
pub fn refCountedStringWithWasNew(this: *VirtualMachine, new: *bool, input_: []const u8, hash_: ?u32, comptime dupe: bool) *JSC.RefString {
+ JSC.markBinding(@src());
const hash = hash_ orelse JSC.RefString.computeHash(input_);
var entry = this.ref_strings.getOrPut(hash) catch unreachable;