Skip to content

Commit 14653fc

Browse files
mittalsonalatul-upadhyay-7
authored andcommitted
test: fix perf_hooks benchmark mock
1 parent 2f3042b commit 14653fc

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

scripts/benchmark-svg.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { beforeEach, describe, expect, it, vi } from 'vitest';
22

3+
const perfHooksMock = vi.hoisted(() => ({
4+
performance: {
5+
now: vi.fn(),
6+
},
7+
}));
8+
39
vi.mock('../lib/svg/generator', () => ({
410
generateSVG: vi.fn(() => '<svg/>'),
511
}));
@@ -10,9 +16,8 @@ vi.mock('../lib/svg/sanitizer', () => ({
1016
}));
1117

1218
vi.mock('perf_hooks', () => ({
13-
performance: {
14-
now: vi.fn(),
15-
},
19+
...perfHooksMock,
20+
default: perfHooksMock,
1621
}));
1722

1823
async function runBenchmarkScript() {

0 commit comments

Comments
 (0)