Skip to content

Commit 29a8d50

Browse files
authoredMay 1, 2023
fix: use public-facing Vitest spy mock functions (#205)
* fix: use public-facing Vitest spy mock functions * typo
1 parent 6ab7fd0 commit 29a8d50

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎src/spies/vitest.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ declare interface Vitest {
77
}
88

99
declare interface ViSpy {
10+
mock: ViSpyMock;
11+
mockRestore(): void;
12+
}
13+
14+
declare interface ViSpyMock {
1015
calls: SpyCallArgs[];
11-
restore(): void;
1216
}
1317

1418
declare const __vitest_index__: Vitest | undefined;
@@ -26,8 +30,8 @@ const createVitestSpyFactory = (spyLibrary: Vitest): SpyFactory => {
2630
const spy = spyLibrary.vi.spyOn(container, methodName);
2731

2832
return {
29-
getCalls: () => spy.calls,
30-
restore: spy.restore,
33+
getCalls: () => spy.mock.calls,
34+
restore: spy.mockRestore,
3135
};
3236
};
3337
};

0 commit comments

Comments
 (0)
Please sign in to comment.