transform does not happen on matched moduleNameMapper file.
See original GitHub issue🐛 Bug Report
transform isn’t ran on matched modules of moduleNameMapper.
To Reproduce
Read the repository’s readMe.md
(npm install && npm test
)
Expected behavior
core.ls
gets compiled using jest.ls.transformer
and there is no error.
Link to repl or repo
https://github.com/ATheCoder/jest-bug
envinfo
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Binaries:
Node: 10.16.1 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
jest unexpected token when importing css - Stack Overflow
The problem is that Jest is hitting these CSS imports and trying to parse them as if they were JavaScript. The "Unexpected token...
Read more >Configuring Jest
While code transformation is applied to the linked setup-file, Jest will not transform any code in node_modules . This is due to the...
Read more >Configuring package.json · Jest
An array of regexp pattern strings that are matched against all source file paths before transformation. If the test path matches any of...
Read more >Configuring Jest compiled - w3resource
When you are using the --config option, the JSON file should not contain a ... setup-file, Jest does not transform any code in...
Read more >jest-preset-angular - npm
By default Jest doesn't transform node_modules , because they should be valid JavaScript files. However, it happens that library authors assume ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue is that your
core
regex matches an internal./core
module in Babel: https://github.com/babel/babel/blob/a2bf68981fbe26a5574607c526818868562fb1f4/packages/babel-types/src/definitions/index.js#L3. This confuses the resolver, which returns yourcore.ls
rather thancore.js
within Babel. This diff makes your tests pass on my machine:We should probably ignore
moduleNameMapper
during an internal require…https://github.com/facebook/jest/blob/8c169d20add61c8831162d8347d2710c07b6b0ef/packages/jest-runtime/src/index.ts#L290-L294 ^
options.isInternalModule
istrue
in this case, but the resolver cares about the user supplied config@thymikee @jeysal thoughts on that?
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.