Migrate from Karma Jasmine to Jest in Angular 10

preview_player
Показать описание
A step by step guide to integrate the Jest test framework to an Angular 10 typescript project using vscode . Here we easily migrate a fresh Angular 10 project using Karma jasmine to jest within 10 minutes.

0:00 - Introduction
0:06 - Migration of Karma Jasmine to Jest
10:38 - Jest watch mode
11:30 - Debugging jest unit test with VSCode
13:30 - Debugging jest unit test with Chrome

Sample github starter repo:
Рекомендации по теме
Комментарии
Автор

Thanks for sharing. I was struggling with the "Unexpected token" error when doing this migration in my project. If I may add, a deprecation warning appears in the console with the configuration shown in the video. To get rid of it, just use the import instead of 'jest-preset-angular' in the setupJest.ts file

christopheradolphe
Автор

3:55 "If you are using the localized function you need to import the localized int function"....can you please show me with a line of code what this means? I'm on Angular 12.

BrianTheTrader
Автор

Thank you for that video. After I've migrated to jest I got this error in every test that does compileComponents().

zone-testing.js is needed for the fakeAsync() test helper but could not be found.
Please make sure that your environment includes zone.js/dist/zone-testing.js.

Do you have any ideas how can I fix it?

cantozzi