Support for v19 hasn't landed yet, at least in a stable version.
But you can already test it by installing jest-preset-angular : 14.4.0-rc.0.
» npm install @angular-builders/jest
Videos
Hello,
I want to hear from the community about Jest tests in Angular.
I have started using it because I listened to some opinions about is fast and "easy" to mock components, services, and so on.
Example:
- I have created a test on a mat toolbar to ensure that some menu items are shown or hidden depending if the user is an admin.
- PR: https://github.com/hseleiro/Organizer/pull/59
- Component: https://github.com/hseleiro/Organizer/blob/test/toolbar-component-jest-test/src/app/shared/components/toolbar.component.ts
- Unit Test: https://github.com/hseleiro/Organizer/blob/test/toolbar-component-jest-test/src/app/shared/components/toolbar.component.spec.ts
Im currently working with implementing testing on my work project and get it to work but since we are using angular 18 with signals inputs/outputs/etc. Does anyone have any experience, resource or anything to share?
» npm install jest-preset-angular
Really simple. There is anyone using them together? I’m struggling a lot to configure jest with the new esm preset.
I've been having a nightmare trying to reconfigure an old project's tests from Jasmine/Karma to Jest, because I have many coworkers advocating for it. But I'm surprised to see that while Karma has been deprecated for almost 2 years now, ng new and the refreshed Angular docs still only go over Karma, and make no mention of Jest or other testing frameworks at all https://angular.dev/guide/testing#other-test-frameworks.
This announcement https://blog.angular.dev/moving-angular-cli-to-jest-and-web-test-runner-ef85ef69ceca mentions @angular-devkit/build-angular:jest but I'm not sure if that's worth using - googling it actually points me to https://www.npmjs.com/package/@angular-builders/jest first but I'm not sure if this is something official.
jest-preset-angular also appears in lots of guides but it seems like every guide has a different way to set that up and I find its documentation kind of a nightmare of its own. Doesn't feel particularly futureproof.
Is Jest going to be a passing fad for Angular? Is there any news of deeper, documented integration anytime soon? Is Web Test Runner support at least close to being ready?