diff --git a/src/runtime/js.zig b/src/runtime/js.zig index 2eb5e1bc..357ce34c 100644 --- a/src/runtime/js.zig +++ b/src/runtime/js.zig @@ -274,12 +274,20 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { } pub fn pumpMessageLoop(self: *const Self) bool { - if (self.platform == null) return false; + if (self.platform == null) { + // In test mode only, platform can be null. + if (builtin.is_test) return false; + @panic("platform is null"); + } return self.platform.?.inner.pumpMessageLoop(self.isolate, false); } pub fn runIdleTasks(self: *const Self) void { - if (self.platform == null) return; + if (self.platform == null) { + // In test mode only, platform can be null. + if (builtin.is_test) return; + @panic("platform is null"); + } return self.platform.?.inner.runIdleTasks(self.isolate, 1); } diff --git a/src/runtime/testing.zig b/src/runtime/testing.zig index 4ecd194f..25695232 100644 --- a/src/runtime/testing.zig +++ b/src/runtime/testing.zig @@ -42,7 +42,7 @@ pub fn Runner(comptime State: type, comptime Global: type, comptime types: anyty const self = try allocator.create(Self); errdefer allocator.destroy(self); - self.env = try Env.init(allocator, .{}); + self.env = try Env.init(allocator, null, .{}); errdefer self.env.deinit(); self.executor = try self.env.newExecutionWorld();