Skip to content

Cannot find package 'vitest' #662

Open
@ghost

Description

  • @testing-library/jest-dom version: 6.6.3
  • node version: v22.13.1
  • jest (or vitest) version: 3.0.5
  • npm (or yarn) version: [email protected]

Relevant code or config:

; .npmrc
hoist=false

What you did:

Tried running tests.

What happened:

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

Suggested solution:

vitest is declared in the devDependencies of @testing-library/jest-dom but it must be declared in the dependencies or peerDependencies because @testing-library/jest-dom/dist/vitest.mjs is importing vitests expect at test run time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions