diff options
author | 2023-04-15 11:52:46 -0400 | |
---|---|---|
committer | 2023-04-15 08:52:46 -0700 | |
commit | f1f736989717e648ca3eaf33712539e07403d717 (patch) | |
tree | a2182c52c50e16071f31747d8e5bf1346c546723 | |
parent | 4b3c483cd48dbf28fb0765970c133de3c7ee31f5 (diff) | |
download | bun-f1f736989717e648ca3eaf33712539e07403d717.tar.gz bun-f1f736989717e648ca3eaf33712539e07403d717.tar.zst bun-f1f736989717e648ca3eaf33712539e07403d717.zip |
toBeFalsy expect counter and test scope check (#2661)
-rw-r--r-- | src/bun.js/test/jest.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bun.js/test/jest.zig b/src/bun.js/test/jest.zig index 3dcecab4c..2c26600c4 100644 --- a/src/bun.js/test/jest.zig +++ b/src/bun.js/test/jest.zig @@ -1478,11 +1478,17 @@ pub const Expect = struct { const thisValue = callFrame.this(); const value: JSValue = Expect.capturedValueGetCached(thisValue) orelse { - globalObject.throw("internal consistency error: the expect(value) was garbage collected but it should not have been!", .{}); + globalObject.throw("Internal consistency error: the expect(value) was garbage collected but it should not have been!", .{}); return .zero; }; value.ensureStillAlive(); + if (this.scope.tests.items.len <= this.test_id) { + globalObject.throw("toBeFalsy() must be called in a test", .{}); + return .zero; + } + active_test_expectation_counter.actual += 1; + const not = this.op.contains(.not); var pass = false; |