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

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

arvinxx opened this issue · comments

  • @testing-library/jest-dom version: 6.4.3
  • node version: 20.9.0
  • jest (or vitest) version: vitest@1.2.2
  • npm (or yarn) version: 9.2.0

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: v6.4.2...v6.4.3#diff-26a76dbc98134c4a252853d189242826b97531753657672282afdd05d608dfac

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

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');

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

Please fix 😭

Guys come on... :D

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

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?

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

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

any temporary fix?

Currently stuck because of this issue

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

🎉 This fix is included in version 6.4.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

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