You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
Are you trying to use any presets? If so, which ones, and what versions? Preact, Jest
Are you using the Yarn client or the npm client? What version? npm 6.14.4
What version of Node.js are you using? 13.12.0
What operating system are you using? macOS 10.14.6
I am experimenting with converting a codebase from React to Preact. When running the Jest tests, I see the following error:
Configuration error:
Could not locate module react mapped as:
/<project-dir>/node_modules/preact/compat$1.
Please check your configuration for these entries:
{
"moduleNameMapper": {
"/^react$/": "/<project-dir>/node_modules/preact/compat$1"
},
"resolver": undefined
}
at createNoMappedModuleFoundError (node_modules/jest-resolve/build/index.js:540:17)
at Object.<anonymous> (node_modules/react-router/cjs/react-router.js:5:29)
The dependency node_modules/preact/compat is installed
Please try to answer the following questions:
I am experimenting with converting a codebase from React to Preact. When running the Jest tests, I see the following error:
The dependency
node_modules/preact/compat
is installedMy suspicion (unconfirmed) is that this is happening due to the trailing
$1
in the rewritten module, which is being set by this line: https://github.com/neutrinojs/neutrino/blob/master/packages/jest/src/index.js#L60Judging by eye, it looks like the rule is expecting a capturing group but the regex doesn't contain one (the actual mapping is coming from https://github.com/neutrinojs/neutrino/blob/master/packages/preact/index.js#L31)
This could also be connected to preact/compat now living in core since preact X
This is easy to replicate in an empty project:
package.json
.neutrinorc.js
jest.config.js
webpack.config.js
src/index.js
tests/index.spec.js
The text was updated successfully, but these errors were encountered: