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
In my last issue, it was about mocking a function in a function whereas in this current issue it's about spying a function in a function and know if the inner function was called.
Spying and mocking is using the same technique by replacing the original function. But this only works for functions which are part of an object and accessible from outside. That's not vue specific and the same thing for common js modules as well.
Describe the bug
Spying a function in a function in a Vue component if these 2 functions are declared in the same vue file doesn't work.
To Reproduce
Minimum reproduction:
https://github.com/mattaiod/VITEST-cant-spy-fn-in-fn-in-component
Expected behavior
Since I have spied fnInside, when I call fnOutside, fnInside should be called
Related information:
@vue/test-utils: 2.1.0
vitest: 0.23.4
Vue: 3.2.40
node: v16.13.1
pnpm: 7.8.0
The text was updated successfully, but these errors were encountered: