Skip to content

Commit 44f0762

Browse files
committed
refactor: use vi global
1 parent 72b3321 commit 44f0762

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/testing/src/testing.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface TestingOptions {
4646

4747
/**
4848
* Function used to create a spy for actions and `$patch()`. Pre-configured
49-
* with `jest.fn()` in jest projects or `vitest.fn()` in vitest projects.
49+
* with `jest.fn()` in jest projects or `vi.fn()` in vitest projects.
5050
*/
5151
createSpy?: (fn?: (...args: any[]) => any) => (...args: any[]) => any
5252
}
@@ -60,6 +60,12 @@ export interface TestingPinia extends Pinia {
6060
app: App
6161
}
6262

63+
declare var vi:
64+
| undefined
65+
| {
66+
fn: (fn?: (...args: any[]) => any) => (...args: any[]) => any
67+
}
68+
6369
/**
6470
* Creates a pinia instance designed for unit tests that **requires mocking**
6571
* the stores. By default, **all actions are mocked** and therefore not
@@ -92,7 +98,7 @@ export function createTestingPinia({
9298
const createSpy =
9399
_createSpy ||
94100
(typeof jest !== 'undefined' && jest.fn) ||
95-
(typeof vitest !== 'undefined' && vitest.fn)
101+
(typeof vi !== 'undefined' && vi.fn)
96102
/* istanbul ignore if */
97103
if (!createSpy) {
98104
throw new Error('You must configure the `createSpy` option.')

0 commit comments

Comments
 (0)