Can't mock module imported inside dependency #6012
Unanswered
joao8lopes
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi team 👋🏽
I'm encountering an issue where a module imported within a dependency is not mocked as expected during testing.
Example:
handler.ts
api-handler.ts
in the unit test, index.test.ts
When running
npx vitest
, I still see the logThis is my log in the console
. I expected this not to happen since 'log' is being mocked. The same issue occurs when trying to mock the implementation of a function that's being created and used insideapi-handler
where the mocked function is not called and instead, the original function is.Is there a reason why the mock isn't being applied as expected?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions