-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot mock spyOn namespace import in browser mode #6099
Comments
Vitest Browser Mode previously had a mode (called Just calling vi.mock("./basic.js", { spy: true }) |
I'm not necessarily requesting this feature (since there is a workaround), just encountered it while moving to browser mode. If you decide against this then just having a nice error message that says it's not supported and suggestion of what to do instead would be great. |
Describe the bug
If you use
spyOn
on a namespace import you get this errorTypeError: Cannot redefine property:
. This seems to work fine injsdom
environment, but not browser mode.Workaround that still gives you the behavior of
spyOn
if you need a "default call original" behavior:Reproduction
basic.js
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: