testing-library / jest-dom

:owl: Custom jest matchers to test the state of the DOM
https://testing-library.com/docs/ecosystem-jest-dom
MIT License
4.4k stars 391 forks source link

the `6.4.3` have an issue of `Cannot find module 'lodash/isEqualWith' ` #598

Closed arvinxx closed 5 months ago

arvinxx commented 5 months ago

Relevant code or config:

we have tests run correctly in 6.4.2 , but failed in 6.4.3

What you did:

npm run test

What happened:

Error: Cannot find module '/Users/arvinxx/CodeProjects/LobeHub/lobe-chat/node_modules/.pnpm/@testing-library+jest-dom@6.4.3_vitest@1.2.2_@edge-runtime+vm@3.2.0_@types+node@20.12.8_happy-dom@14.7.1_terser@5.31.0_/node_modules/lodash/isEqualWith' imported from /Users/arvinxx/CodeProjects/LobeHub/lobe-chat/node_modules/.pnpm/@testing-library+jest-dom@6.4.3_vitest@1.2.2_@edge-runtime+vm@3.2.0_@types+node@20.12.8_happy-dom@14.7.1_terser@5.31.0_/node_modules/@testing-library/jest-dom/dist/index.mjs
Did you mean to import lodash@4.17.21/node_modules/lodash/isEqualWith.js?

you can check the test ci here: https://github.com/lobehub/lobe-chat/actions/runs/8935588080/job/24544431213

Reproduction:

https://github.com/lobehub/lobe-chat/tree/reproduction/jest-dom-6.4.3

Problem description:

it shows the lodash/isEqualWith can not be found

Suggested solution:

I think the issue caused by the change of this: https://github.com/testing-library/jest-dom/compare/v6.4.2...v6.4.3#diff-26a76dbc98134c4a252853d189242826b97531753657672282afdd05d608dfac

it should be the import isEqualWith from 'lodash/isEqualWith.js'

aurorascharff commented 5 months ago

I encountered this as well. Inspecting my node_modules/@testing-library/jest-dom/dist/node-modules, there is no lodash in here, only dom-accessibility-api (missing also other packages) from node_modules/@testing-library/jest-dom/dist/index.ts:

require('redent'); require('@adobe/css-tools'); require('dom-accessibility-api'); require('aria-query'); require('chalk'); require('lodash/isEqualWith'); // this one is the failing one require('css.escape');

aurorascharff commented 5 months ago

Looking at commits: There is this 1 commit between 6.4.2 and 6.4.3 that isn't in in the release log but contains changes that might be relevant.

https://github.com/testing-library/jest-dom/commit/bd82f64592696c9710c59becaf1adfeb1e4c6169

image image

larsmunkholm commented 5 months ago

Please fix 😭

rhummelmose commented 5 months ago

Guys come on... :D

ddolcimascolo commented 5 months ago

Hit by this too. Do you need any help guys?

ddolcimascolo commented 5 months ago

Looking at commits: There is this 1 commit between 6.4.2 and 6.4.3 that isn't in in the release log but contains changes that might be relevant.

bd82f64

image image

@re-taro Can you check?

drazenbuljovcic commented 5 months ago

Hit by this just now as well. Obv before the issue if fixed you can pin to 6.4.2.

MatanBobi commented 5 months ago

Just encountered this one too, I've created a PR. Thanks everyone for the report :)

ddolcimascolo commented 5 months ago

Any ETA?

KevBeltrao commented 5 months ago

any temporary fix?

timothyokooboh commented 5 months ago

Currently stuck because of this issue

philwolstenholme commented 5 months ago

There's no need for this to block anyone or to rush the maintainers to release a fix, just downgrade to the last working version. Google for something like 'npm install specific version'.

I am on my phone so this might not be 100% copy/pastable but try something like npm i "@testing-library/jest-dom@6.4.2" --save-dev

MatanBobi commented 5 months ago

:tada: This fix is included in version 6.4.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

okize commented 5 months ago

v6.4.5 fixed the issue for me, thank you for the fast fix!