aboutsummaryrefslogtreecommitdiff
path: root/src/js_parser.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-06-09 16:38:06 -0700
committerGravatar GitHub <noreply@github.com> 2023-06-09 16:38:06 -0700
commitbf518222d456c913fc5e6b6e0d14952d76c0ce91 (patch)
tree99431a14fefb1b52b75ea0528b68232e8af2cb7c /src/js_parser.zig
parent6565bd89d533b17d0d975f2790a4b4d37d8aecc1 (diff)
downloadbun-bf518222d456c913fc5e6b6e0d14952d76c0ce91.tar.gz
bun-bf518222d456c913fc5e6b6e0d14952d76c0ce91.tar.zst
bun-bf518222d456c913fc5e6b6e0d14952d76c0ce91.zip
Implement mocks in bun:test (#3252)
* wip * wip * most of the code for mocks in bun:test * finishing up * Implement `toHaveBeenCalled` and `toHaveBeenCalledTimes(1)` * Test * visit * results, not returnValues * exact * Update jest.zig * A couple more tests * Add jest.fn * support resetting mocks * Implement spyOn --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/js_parser.zig')
-rw-r--r--src/js_parser.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/js_parser.zig b/src/js_parser.zig
index 5f46507d7..5dc69f469 100644
--- a/src/js_parser.zig
+++ b/src/js_parser.zig
@@ -4674,6 +4674,7 @@ const Jest = struct {
afterEach: Ref = Ref.None,
beforeAll: Ref = Ref.None,
afterAll: Ref = Ref.None,
+ jest: Ref = Ref.None,
};
// workaround for https://github.com/ziglang/zig/issues/10903
@@ -6474,6 +6475,7 @@ fn NewParser_(
if (p.options.features.inject_jest_globals) {
p.jest.describe = try p.declareCommonJSSymbol(.unbound, "describe");
p.jest.@"test" = try p.declareCommonJSSymbol(.unbound, "test");
+ p.jest.jest = try p.declareCommonJSSymbol(.unbound, "jest");
p.jest.it = try p.declareCommonJSSymbol(.unbound, "it");
p.jest.expect = try p.declareCommonJSSymbol(.unbound, "expect");
p.jest.beforeEach = try p.declareCommonJSSymbol(.unbound, "beforeEach");