I just created angular application using the cli (v8 - last version from today). nothing special I done so far. (ng new ng-app
).
I use jest-schematic to add jest to my angular project.
cd ng-app
ng add @briebug/jest-schematic
The problem is I get an error when I run the test using: npm run test
:
> jest
FAIL src/app/app.component.spec.ts
● Test suite failed to run
File not found: jest-preset-angular/InlineHtmlStripStylesTransformer.js (resolved as: C:\ng-app\jest-preset-angular\InlineHtmlStripStylesTransformer.js)
What is missing here? How do I fix that?
In the jest-preset-angular documentation, the corrent configuration is this: jest-preset-angular/build/InlineFilesTransformer
.
So change in your package.json
the lines from:
"astTransformers": [
"jest-preset-angular/InlineHtmlStripStylesTransformer.js"
]
to
"astTransformers": [
"jest-preset-angular/build/InlineFilesTransformer",
"jest-preset-angular/build/StripStylesTransformer"
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With