Vitest not mocking dependency when module uses it? #587
Unanswered
RPDeshaies
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Yes, It works only for code, that goes through vite-node pipeline. Usually it's user code, but you can try inlining it with |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I was wondering if it was normal that Vitest doesn't use the provided module mock when a package listed as a dependency is using it ?
What I mean is, we have an
internal
package (bundled in CommonJS) that usesdependency-to-mock
.When I call
I expect Vitest to mock all imports of that module, but I have the impression it only works if my code imports
dependency-to-mock
, but it doesn't work if another package does it.Any thoughts? Thanks in advance! :)
Beta Was this translation helpful? Give feedback.
All reactions