Angular: Boost jest performance

Although it’s obvious that jest performs much better than jasmine/karma, I’ve had the impression that my tests should run much faster than they actually do. In my current project I have about 450 tests. One test run takes about 55 seconds. With this simple trick I brought down the execution time to about 35 seconds:

Add isolatedModules=true to the ts-jest configuration in jest.config.js:

// jest.config.js
module.exports = {
  // [...]
  globals: {
    'ts-jest': {
      isolatedModules: true

You can expect this setting to be automatically configured in the next version of @froko/ng-essentials.


ts-jest: Isolated Modules option