jest migration for Angular 9

Stefan Matar
1 min readFeb 19, 2020
Error: Uncaught (in promise): Failed to load button.component.html

So, Angular 9 just came out. And you are one of the people who use Nx to manage an angular monorepo.

So instead of upgrading Angular itself, you would rather upgrade your nrwl workspace at once in order to update all nrwl configured dependencies like angular, cypress, etc.

So you do

ng update @nrwl/workspace

Every dependency is upgraded automatically. Multiple jest configs are automatically changed. After that you run your tests and everything works fine. Except you probably can’t run them in your IDE.

What helped our Organization was upgrading the jest dependency manually and checking the migration guide for jest 25.

We needed to change our jest.config.js:

astTransformers: [...]toastTransformers: [ ‘jest-preset-angular/build/InlineFilesTransformer’, ‘jest-preset-angular/build/StripStylesTransformer’]

Check if you applied all the needed steps in the migration guide, as nx doesn’t do that automatically.

--

--