Skip to content

fix: import vitest is not needed to extend the module #666

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

Conversation

dnafication
Copy link

The import is causing an issue as it is now making vitest a dependency of the module and results in error when running tests such as:

Error: Cannot find package 'vitest' imported from /path/to/project/ui/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/jest-dom/dist/vitest.mjs

fixes #662

What:

Why:

How:

Checklist:

  • Documentation
  • Tests
  • Updated Type Definitions
  • Ready to be merged

The import is causing an issue as it is now making vitest a dependency of the module and results in error when running tests such as:
```
Error: Cannot find package 'vitest' imported from /path/to/project/ui/node_modules/.pnpm/@testing-library[email protected]/node_modules/@testing-library/jest-dom/dist/vitest.mjs
```
@G-Rath
Copy link
Contributor

G-Rath commented Mar 12, 2025

As I said in #646, this file is not the issue because it cannot be run (it's literally not valid runtime syntax), and your error message tells you that because it's pointing at dist/vitest.mjs whereas this file is types/vitest.d.ts.

The file you want in the source is this one, however I would first recommend you post a reproduction repository because that import isn't new, and I have a vitest project with latest @testing-library/jest-dom which is running fine so I don't think the import needs changing.

@dnafication
Copy link
Author

dnafication commented Mar 13, 2025

As I said in #646, this file is not the issue because it cannot be run (it's literally not valid runtime syntax), and your error message tells you that because it's pointing at dist/vitest.mjs whereas this file is types/vitest.d.ts.

That makes sense. Let me investigate that further :) I'll close this off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot find package 'vitest'
2 participants