Skip to content
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

When using babel plugins in vite react config, vitest extension throws error when one of the test files changes #379

Open
4 tasks done
jtiala opened this issue May 10, 2024 · 0 comments

Comments

@jtiala
Copy link

jtiala commented May 10, 2024

Describe the bug

When using babel plugins (at least the formatjs plugin) in Vite config, vitest extension throws error Error: Cannot find package 'babel-plugin-formatjs' imported from /babel-virtual-resolve-base.js when one of the test files changes.

Reproduction

https://github.com/jtiala/vitest-vscode-babel-plugin-bug-repro

  1. Run tests in Vitest VS Code extension. They should run fine. Re-running and refressing works.
  2. Make any change in sum.test.ts and save.
  3. The extension throws error Error: Cannot find package 'babel-plugin-formatjs' imported from /babel-virtual-resolve-base.js

screenshot

  1. This breaks some features of the extension. Tests cannot be run from the gutter, for example.
  2. Refreshing tests or running all tests gets rid of the error and allows the extension to function correctly, up until the next save in any test file.
  3. When running tests from the command line, this doesn't happen.

Output

[INFO 9.02.48] Running 1 file(s) with name pattern: ^\s?adds 1 \+ 2 to equal 3$
[Worker] Collecting tests due to file changes: src/sum.test.ts

Version

v0.10.2

Validations

@jtiala jtiala changed the title When using babel plugins in vite config, vitest extension throws error when one of the test files changes When using babel plugins in vite react config, vitest extension throws error when one of the test files changes May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant