nx: jest-preset-angular v8 has breaking changes
Please make sure you have read the submission guidelines before posting an issue
Prerequisites
Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- I am running the latest version
- I checked the documentation and found no answer
- I checked to make sure that this issue has not already been filed
- I’m reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)
Expected Behavior
Running jest tests does not fail
Current Behavior
Jest tests fail with the following error message:
Module jest-preset-angular/AngularSnapshotSerializer.js in the snapshotSerializers option was not found.
Steps to Reproduce
- update jest-preset-angular to 8.0.0
- run jest tests
Other
I looked into jest-preset-angular and it seems that they introduced a build folder with v8 thus the path is not correct anymore.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 18
- Comments: 19 (2 by maintainers)
Commits related to this issue
- feat(testing): update to jest-preset-angular v8.0.0 Updates to jest-preset-angular to v8.0.0, includes migrations to fix any existing projects affected by the jest-preset-angular update. closes #197... — committed to JoshMentzer/nx by mentzerj 5 years ago
- feat(testing): update to jest-preset-angular v8.0.0 Updates to jest-preset-angular to v8.0.0, includes migrations to fix any existing projects affected by the jest-preset-angular update. closes #197... — committed to JoshMentzer/nx by mentzerj 5 years ago
- feat(testing): update to jest-preset-angular v8.0.0 Updates to jest-preset-angular to v8.0.0, includes migrations to fix any existing projects affected by the jest-preset-angular update. closes #197... — committed to JoshMentzer/nx by mentzerj 5 years ago
- feat(testing): update to jest-preset-angular v8.0.0 Updates to jest-preset-angular to v8.0.0, includes migrations to fix any existing projects affected by the jest-preset-angular update. closes #197... — committed to JoshMentzer/nx by mentzerj 5 years ago
- feat(testing): update to jest-preset-angular v8.0.0 Updates to jest-preset-angular to v8.0.0, includes migrations to fix any existing projects affected by the jest-preset-angular update. closes #197... — committed to FrozenPandaz/nx by mentzerj 5 years ago
- feat(testing): update jest-preset-angular to v8.0.0 Closed issues: #1979, #2165 Co-authored-by: Joshua D. Mentzer <mentzerj@trinity-health.org> — committed to FrozenPandaz/nx by mehrad-rafigh 4 years ago
- feat(testing): update to jest-preset-angular v8.0.0 part 1 Updates to jest-preset-angular to v8.0.0, includes migrations to fix any existing projects affected by the jest-preset-angular update. clos... — committed to FrozenPandaz/nx by mentzerj 5 years ago
- feat(testing): update jest-preset-angular to v8.0.0 part 2 Closed issues: #1979, #2165 Co-authored-by: Joshua D. Mentzer <mentzerj@trinity-health.org> — committed to FrozenPandaz/nx by mehrad-rafigh 4 years ago
- feat(testing): update to jest-preset-angular v8.0.0 part 1 Updates to jest-preset-angular to v8.0.0, includes migrations to fix any existing projects affected by the jest-preset-angular update. clos... — committed to FrozenPandaz/nx by mentzerj 5 years ago
- feat(testing): update jest-preset-angular to v8.0.0 part 2 Closed issues: #1979, #2165 Co-authored-by: Joshua D. Mentzer <mentzerj@trinity-health.org> — committed to FrozenPandaz/nx by mehrad-rafigh 4 years ago
- feat(testing): update to jest-preset-angular v8.0.0 (#2401) * feat(testing): update to jest-preset-angular v8.0.0 part 1 Updates to jest-preset-angular to v8.0.0, includes migrations to fix any exis... — committed to nrwl/nx by FrozenPandaz 4 years ago
in your module, you may have the file jest.config.js with the following content.
comment or remove the member “snapshotSerializers”. It is not needed. Worked for me, The resulting should be
@leon I managed to fix it by changing
jest-preset-angular/AngularSnapshotSerializer.js
tojest-preset-angular/build/AngularSnapshotSerializer.js
andjest-preset-angular/HTMLCommentSerializer.js
tojest-preset-angular/build/HTMLCommentSerializer.js
.Since in latest version of jest they have been moved under
/build
directory. REF: https://github.com/thymikee/jest-preset-angular/releases/tag/v8.0.0Any updates on this? I updated my nx repo to jest 25 and now it’s complaining about jest-preset-angular not supporting jest 25
What is needed to get this merged into the next release?
Nice, I feel like upgrade to jest-angular-preset will help with problems I have. Cant wait until this is there
How does it look guys? Any plans?
i literally checked node_modules/jest-preset-angular/build folder and the files, InlineFilesTransformer, StripStylesTransformer, HTMLCommentSerializer and AngularSnapshotSerializer are nowhere to be foung. any idea what’s causing this issue? I’m running my test on my Angular 10 app. here are some of my project details:
node_modules\@nrwl\jest\src\builders\jest\jest.impl.js
If you updateastTransformers
from:['jest-preset-angular/InlineHtmlStripStylesTransformer']
TO['jest-preset-angular/build/InlineFilesTransformer', 'jest-preset-angular/build/StripStylesTransformer']
TheFile not found
error is gone, but there is a new problem:Uncaught (in promise): Failed to load app.component.html
plus few more.It looks, NX is not compatible with the
"jest-preset-angular": "8.0.0"
.@ashokshetty1970 didn’t work for me.