jest-dom
jest-dom copied to clipboard
Error in --experimental-vm-modules, when resolveStubModuleName(), jest-dom cause wrong from params
@testing-library/jest-domversion: 6.1.3nodeversion: 18.17jest(orvitest) version: 29.7.0npm(oryarn) version: 10.0
Relevant code or config:
jest.unstable_mockModule("./xxxx-list/index.js", () => ({
XXXXList: jest.fn(() => null),
}));
What you did:
Normal test case, crash when upgrade to 6.1.3
What happened:
Reproduction:
Create a test file with
jest.unstable_mockModule("./xxxx-list/index.js", () => ({
XXXXList: jest.fn(() => null),
}));
Start jest with node --experimental-vm-modules node_modules/jest/bin/jest.js
then jest will try to execute resolveStubModuleName(from, moduleName) at node_modules/jest-resolve/build/resolver.js
without jest-dom the function looks like below
after I import import "@testing-library/jest-dom/jest-globals"; in setup file.
the from param will become @testing-library/jest-dom/dist/jest-globals.mjs as screenshot below