-
-
Notifications
You must be signed in to change notification settings - Fork 198
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 and transform options are being ignored for third party library #85
Comments
I'll take a look, but as far as I can tell it's either configuration issue or |
From a quick Googling I found the most probable candidate for the source of the problem. |
@meltedspark thanks... will take a look at that. |
I am having the same issue, I am using the ngx-cookie-service library and it does not work when using jest. I have tried following instructions mentioned in this issue for jest-preset-angular but it seems that the "transform" property is not extendable when using the jest angular-builder so the code never runs through the babel-jest transform. Any help would be appreciated |
Could you create a repository with a minimal reproduction? |
Ok, I have read the ts-jest issue that you have referred to in more detail and managed to pin point the issue to the ts-jest setting. basically when I add the following setting to ts-jest: "ts-jest": {
...
"allowSyntheticDefaultImports": true
} everything starts working as expected. So my final jest.config.js looks like this: const esModules = ['ngx-cookie-service'].join('|');
module.exports = {
globals: {
"__TRANSFORM_HTML__": true,
"ts-jest": {
"tsConfigFile": `${__dirname}\\tsconfig.spec.json`,
"allowSyntheticDefaultImports": true
}
},
preset: "jest-preset-angular",
testURL: "https://github.com/@angular-cli-builders",
transformIgnorePatterns: [`<rootDir>/node_modules/(?!${esModules})`],
"transform": {
"^.+\\.js$": "babel-jest"
}
}; hopefully this will be useful to anyone else who experiences the same issue |
@jusefb That is great, thanks for sharing! I'm thinking of creating a section for frequent problems in the readme. Would you mind issuing a PR for that? |
Sure, never done it before :) will you need to create the section first? |
You are welcome to create it yourself. |
Hi, this is a sample repo with the problem happening:
https://github.com/edwinabt/abt-jest-ng-app
Run the regular Angular steps to run an app:
Now, the problem is with a library called ng-gapi that wraps the Google API SDK to be used in angular. When you run ng test it reports the test failed because of Jest encountered an unexpected token. I've read about this problem and tried the possible solutions, but, none are working for me.
Is this a bug? or I am doing something wrong?
The text was updated successfully, but these errors were encountered: