Angular-cli: Native Jest support as alternative testing solution

Created on 17 Nov 2020  路  2Comments  路  Source: angular/angular-cli

馃殌 feature request

Relevant Package


This feature request is for @angular/common

Description

My suggestion is to support jest as default testing framework. Currently it's possible to use jest but it requires additional setup and an external dependency called jest-preset-angular to get not overwhelmed with configuration stuff. In my eyes jest brings some serious advantages over Karma.

  • Parallel test execution
  • Rerun only affected tests
  • Headless by default
  • Well documented

Describe the solution you'd like

Jest support without additional configuration setup. A possible solution could be a parameter on the ng new command which let the user decide the testing framework.

Describe alternatives you've considered

Setup custom testing configuration for each project and use the external package jest-preset-angular

I've searched for similar issues here on GitHub but found nothing about this topic. Maybe we can discuss here if such a feature is useful or not. Is there anything I'm missing why there is no default support yet?

Most helpful comment

Looking forward to this 馃榾

All 2 comments

Looking forward to this 馃榾

Hi @markuscodes1,

Thanks for opening this feature request. This has been brought up a couple of times. And you can find the original issue https://github.com/angular/angular-cli/issues/4543. Replacing Karma with another testing framework is not currently in the roadmap of Angular CLI. In addition where possible we'd like not to diverge too much from the internal Google tools set.

Supporting both Jest and Karma would also be require a considerable amount of effort, especially considering that Jest requires its own pipeline as it doesn't integrate with Webpack. For more context see https://github.com/angular/angular-cli/issues/4543#issuecomment-303364585

There are 3rd party tools that makes Jest integration with the CLI easier and simpler such as:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

purushottamjha picture purushottamjha  路  3Comments

hartjo picture hartjo  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments