Provide an error message if a mock will be ignored because it was imported in a setup file #4759
richardboehme
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
It should actually be possible to check because the path to the module is resolved in place. We can just check if it's already inside the module cache, not in mock cache. But I am not sure if there are use cases when this is expected behavior. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Referring to #1450, we just "wasted" ~1.5 hours finding out that our test was affected by this. This is due to mocks just being ignored without any notice. Without any knowledge about the architecture of Vitest: Would it be possible to provide the user
a meaningful error message if a mock of an already cached module is created? I suspect it may be affected by the performance penalty mentioned in the issue, but I still wanted to ask if it may be feasible.
If it would be possible and the maintainers agree on it being valuable, we would be happy to contribute or help to contribute.
Beta Was this translation helpful? Give feedback.
All reactions