-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transformIgnorePatterns doesn't work #6975
Comments
Could you put together a repo we can pull down to reproduce? |
I'm having this issue after upgrading to babel 7 - appears the babelrc option for the test env is not being applied to the excluded modules |
Hi @SimenB, I uploaded a demo. please look at https://github.com/aslanovsergey/Jest-Demo-transformIgnorePatterns |
I have exactly the same issue. When I put some invalid regex in transformIgnorePatterns it throws an error so I'm sure that it uses it, but when I try to really exclude something it is not possible. Is that a Jest issue or am I doing sth wrong? Thanks! |
Having the same exact problem. @aslanovsergey, @alexkrolick, @tscislo - did any of you find a fix? |
I'm having the same issue. Any updates? |
@aslanovsergey sorry about the delay, finally found some time to dig a bit into your repo. You have at least 2 issues in configuration: You do not pass diff --git i/package.json w/package.json
index 6cf2af6..4c66bc7 100644
--- i/package.json
+++ w/package.json
@@ -42,7 +42,7 @@
"jest": {
"verbose": true,
"transform": {
- "^.+\\.(ts|tsx)$": "ts-jest"
+ "^.+\\.(js|ts|tsx)$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(ts?|tsx?)$",
"moduleFileExtensions": [
diff --git i/tsconfig.json w/tsconfig.json
index f13ec27..b12a712 100644
--- i/tsconfig.json
+++ w/tsconfig.json
@@ -10,6 +10,7 @@
"experimentalDecorators": true,
"skipLibCheck": true,
"outDir": "lib",
+ "allowJs": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft" However, the file is still not transpiled because of how Jest uses the ignore pattern. See the following snippet: https://github.com/facebook/jest/blob/v23.6.0/packages/jest-runtime/src/script_transformer.js#L484-L502, specifically const patterns = [
'node_modules\\@microsoft\\sp-dialog',
'node_modules/(?!sp-dialog)',
'node_modules/(?!@microsoft/sp-dialog)'
].join('|');
new RegExp(patterns).test(
'/home/user/project/Jest-Demo-transformIgnorePatterns/node_modules/@microsoft/sp-dialog/lib/index.js'
); // logs true However, the pattern works correctly if you combine it into a single one: Running that correctly transpiles your code, but you get a runtime error when executing: Can't help you with that one. (The stack trace is messed up, not sure why...) |
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. |
🐛 Bug Report
I have this exception
And tried these transformIgnorePatterns expressions in config.json
and none of them worked. I run this on Windows 10 so I tried also this format https://jestjs.io/docs/en/cli.html#jest-regexfortestfiles
Run
npx envinfo --preset jest
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i5-4460S CPU @ 2.90GHz
Binaries:
npm: 5.10.0 - C:\Program Files\nodejs\npm.CMD
The text was updated successfully, but these errors were encountered: