mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
[wiptest] fix calling toBe in describe (#1000)
This commit is contained in:
@@ -365,6 +365,16 @@ pub const Expect = struct {
|
||||
);
|
||||
return js.JSValueMakeUndefined(ctx);
|
||||
}
|
||||
if (this.scope.tests.items.len <= this.test_id) {
|
||||
JSC.JSError(
|
||||
getAllocator(ctx),
|
||||
".toBe() called in wrong scope",
|
||||
.{},
|
||||
ctx,
|
||||
exception,
|
||||
);
|
||||
return js.JSValueMakeUndefined(ctx);
|
||||
}
|
||||
this.scope.tests.items[this.test_id].counter.actual += 1;
|
||||
const left = JSValue.fromRef(arguments[0]);
|
||||
left.ensureStillAlive();
|
||||
@@ -418,6 +428,16 @@ pub const Expect = struct {
|
||||
);
|
||||
return js.JSValueMakeUndefined(ctx);
|
||||
}
|
||||
if (this.scope.tests.items.len <= this.test_id) {
|
||||
JSC.JSError(
|
||||
getAllocator(ctx),
|
||||
".toHaveLength() called in wrong scope",
|
||||
.{},
|
||||
ctx,
|
||||
exception,
|
||||
);
|
||||
return js.JSValueMakeUndefined(ctx);
|
||||
}
|
||||
this.scope.tests.items[this.test_id].counter.actual += 1;
|
||||
|
||||
const expected = JSC.JSValue.fromRef(arguments[0]).toU32();
|
||||
|
||||
Reference in New Issue
Block a user