-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
💥 Regression Report
require.requireActual no longer seems to use moduleNameMapper when resolving path. Seems to be caused by this change https://github.com/facebook/jest/pull/7404/files#diff-5b4dfdf819aec7c512e60abc8ed754b5R850
Last working version
Worked up to version: 23.6.0
Stopped working in version: 24.0.0
To Reproduce
Add any moduleNameMapper config, EG:
{
"moduleNameMapper": {
"/lib$": "<rootDir>/mapped-lib.js"
}
}Create mapped module at destination path
// mapped-lib.js
module.exports = {}require.requireActual the source path
// add.test.js
require.requireActual('./lib')Expected behavior
Mapped module should be loaded without error
Link to repl or repo (highly encouraged)
Working repl in Jest 22.1.2
https://repl.it/repls/UnusedBoldNlp
In Jest 24.1.0 this errors:
● Test suite failed to run
Cannot find module './lib' from 'add.test.js'
Run npx envinfo --preset jest
Paste the results here:
System:
OS: macOS 10.14
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
Yarn: 1.12.3 - ~/.nvm/versions/node/v10.13.0/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
npmPackages:
jest: 24 => 24.1.0tabrindle and miluoshi