-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Tests failing when run the test first time after installation #2845
Comments
@kazupon as quick work-around for now you can add following in afterAll(() => {
vi.restoreAllMocks()
}) For some reason the |
@AriPerkkio
Yeah!, I have noticed this issue being caused by |
I’ve kept this issue at https://github.com/nuxt-modules/i18n/tree/repro/vitest-issue |
Minimal reproduction: https://stackblitz.com/edit/vitest-dev-vitest-xeb6cf |
It is a bug that we don't restore mocks between different files. This only affects builtin modules. #2857 should address this. |
Describe the bug
I've been using vitest to develop nuxt modules so far.
I have changed the code in this PR without changing the code around dependencies and imports. However, when I run the tests, the tests are now failing in CI with the following error code:
It seems that the code I imported is
undefined
.I noticed this issue in CI.
Additional info:
Reproduction
Unfortunately, I could not reproduce with minimal codes, but We can reproduce realworld code.
repo: https://github.com/nuxt-modules/i18n
reproduction step:
git clone git@github.com:nuxt-modules/i18n.git
git checkout fix/1834
pnpm install
pnpm test:unit
So, you can face issue.
By the way, if we do
pnpm test:unit
again, the test works correctly.System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: