@@ -46,7 +46,7 @@ export interface TestingOptions {
46
46
47
47
/**
48
48
* Function used to create a spy for actions and `$patch()`. Pre-configured
49
- * with `jest.fn()` in jest projects.
49
+ * with `jest.fn()` in jest projects or `vitest.fn()` in vitest projects
50
50
*/
51
51
createSpy ?: ( fn ?: ( ...args : any [ ] ) => any ) => ( ...args : any [ ] ) => any
52
52
}
@@ -64,8 +64,8 @@ export interface TestingPinia extends Pinia {
64
64
* Creates a pinia instance designed for unit tests that **requires mocking**
65
65
* the stores. By default, **all actions are mocked** and therefore not
66
66
* executed. This allows you to unit test your store and components separately.
67
- * You can change this with the `stubActions` option. If you are using jest,
68
- * they are replaced with `jest. fn()`, otherwise, you must provide your own
67
+ * You can change this with the `stubActions` option. If you are using jest or vitest ,
68
+ * they are replaced with basic ` fn()`, otherwise, you must provide your own
69
69
* `createSpy` option.
70
70
*
71
71
* @param options - options to configure the testing pinia
@@ -89,7 +89,7 @@ export function createTestingPinia({
89
89
90
90
plugins . forEach ( ( plugin ) => pinia . use ( plugin ) )
91
91
92
- const createSpy = _createSpy || ( typeof jest !== 'undefined' && jest . fn )
92
+ const createSpy = _createSpy || ( typeof jest !== 'undefined' && jest . fn ) || ( typeof vitest !== 'undefined' && vitest . fn )
93
93
/* istanbul ignore if */
94
94
if ( ! createSpy ) {
95
95
throw new Error ( 'You must configure the `createSpy` option.' )
0 commit comments