Skip to content

Commit 394f655

Browse files
committed
feat(testing): warn about incorrect createSpy
See #2896
1 parent 58a2302 commit 394f655

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/testing/src/testing.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,14 @@ export function createTestingPinia({
129129
/* istanbul ignore if */
130130
if (!createSpy) {
131131
throw new Error(
132-
'[@pinia/testing]: You must configure the `createSpy` option.'
132+
'[@pinia/testing]: You must configure the `createSpy` option. See https://pinia.vuejs.org/cookbook/testing.html#Specifying-the-createSpy-function'
133+
)
134+
} else if (
135+
typeof createSpy !== 'function' ||
136+
'mockReturnValue' in createSpy
137+
) {
138+
throw new Error(
139+
'[@pinia/testing]: Invalid `createSpy` option. See https://pinia.vuejs.org/cookbook/testing.html#Specifying-the-createSpy-function'
133140
)
134141
}
135142

0 commit comments

Comments
 (0)