testing-library / jest-dom

:owl: Custom jest matchers to test the state of the DOM

Home Page:https://testing-library.com/docs/ecosystem-jest-dom

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

6.1.0 failing on "Cannot find module '@testing-library/jest-dom'"

andrewbusch7 opened this issue · comments

  • @testing-library/jest-dom version: 6.1.0
  • node version: v18.13.0
  • npm version: 8.19.3

Relevant code or config:

File src/setupTests.js

import "@testing-library/jest-dom";

What you did:

I upgraded from 6.0.1 to 6.1.0. Rollback to 6.0.1 fixes it.

What happened:

npm run tests now returns a failure on every test:

Cannot find module '@testing-library/jest-dom' from 'src/setupTests.js' for every test run

Reproduction:

If the root cause isn't obvious, I can work on a repo with a replicable example.

Problem description:

Fails always on current version.

Suggested solution:

My guess is something in 61d17bd broke things.

In package.json
there a lines

  "main": "dist/cjs/index.js",
  "module": "dist/esm/index.js",

These files are not in package

I have fixed this in PR #523

commented

There's a great package: https://publint.dev/ that can lint the package json for proper hybrid settings!
Might be worth adding it to them mix

commented

I believe the problem is actually with the new version of the @adobe/css-tools package. I've submitted a PR with them: adobe/css-tools#183

Can someone who's had this issue please verify if it's working or still erroring with jest-dom 6.1.2? We've fixed all our ESM publishing issues as far as I'm aware, so it could be adobe/css-tools#183.

Yep working for me too, thanks all!

commented

Can someone who's had this issue please verify if it's working or still erroring with jest-dom 6.1.2? We've fixed all our ESM publishing issues as far as I'm aware, so it could be adobe/css-tools#183.

The v6.1.2 fixed it for me. Thank you!