Skip to content

Commit

Permalink
fix: use public-facing Vitest spy mock functions (#205)
Browse files Browse the repository at this point in the history
* fix: use public-facing Vitest spy mock functions

* typo
  • Loading branch information
JoshuaKGoldberg authored May 1, 2023
1 parent 6ab7fd0 commit 29a8d50
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/spies/vitest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ declare interface Vitest {
}

declare interface ViSpy {
mock: ViSpyMock;
mockRestore(): void;
}

declare interface ViSpyMock {
calls: SpyCallArgs[];
restore(): void;
}

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

return {
getCalls: () => spy.calls,
restore: spy.restore,
getCalls: () => spy.mock.calls,
restore: spy.mockRestore,
};
};
};
Expand Down

0 comments on commit 29a8d50

Please sign in to comment.