You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StrykerJS creates a sandbox directory for your project by default. Inside that sandbox directory, it copies all project files while mutating your production code. However when running vi.mock it doesn't seem to work because of this sandboxing mechanism. I've reproduced it using just vitest (without StrykerJS).
Note: I'm sure the "sandboxing" is the issue here. StrykerJS also supports --inPlace mode, that disables sandboxing and I can confirm that Stryker works as expected in that case.
run cd .stryker-tmp/sandbox-aGW0K0 (this is a copy of the project, but instrumented with mutations)
again, use npx vitest. You can now see the error: TypeError: [Function Discount] is not a spy or a call to a spy!
The console outputs includes:
Error: [MSW] Failed to register a Service Worker for scope ('http://localhost:63315/') with script ('http://localhost:63315/mockServiceWorker.js'): Service Worker script does not exist at the given path.
Did you forget to run "npx msw init <PUBLIC_DIR>"?
Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/init
Describe the bug
StrykerJS creates a sandbox directory for your project by default. Inside that sandbox directory, it copies all project files while mutating your production code. However when running
vi.mock
it doesn't seem to work because of this sandboxing mechanism. I've reproduced it using justvitest
(without StrykerJS).Note: I'm sure the "sandboxing" is the issue here. StrykerJS also supports
--inPlace
mode, that disables sandboxing and I can confirm that Stryker works as expected in that case.Reproduction
issue.zip
npm i
npx vitest
. See that it works.cd .stryker-tmp/sandbox-aGW0K0
(this is a copy of the project, but instrumented with mutations)npx vitest
. You can now see the error:TypeError: [Function Discount] is not a spy or a call to a spy!
The console outputs includes:
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: