-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
vi.mock
's importOriginal
stuck on circular imports
#4373
Comments
|
Very frustrating, especially because it is completely silent. Spent few hours on this. |
This issue appears to be related to: I ultimately fixed this for myself by addressing the circular dependencies (using the eslint rule: https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md#when-not-to-use-it) However, it was incredibly difficult to determine that it was ultimately the circular dependencies since vitest just hung without any error output or timeout. Hope these issues can get visibility for others stuck with this. |
I ran into this issue again - this time caused by circular dependency coming from a barrel file. By using the vitest/packages/vite-node/README.md Lines 152 to 158 in 039814b
|
I found the culprit, PR incoming. |
How can I test this fix? Alternatively, can a new release be made with the fix? |
Ok I managed to make it work and this does fix the issue. I just had to remove the |
Describe the bug
When a test imports file that contains circular imports and also mocks some of these files,
vi.mock
'simportOriginal
does not resolve. Whats worse is thatvite-node
silently hangs and doesn't log any timeout errors. Evenbirpc
doesn't timeout here for some reason.Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-8gzjhq?file=test%2Fcyclic-import.test.mjs
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: