cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add isolatedModules

beigert
Contributor

Right now documentation suggest fields like this in the jest.config: link 

transform: {
".(css|scss|sass|less)$": "<rootDir>/style-mock.ts",
},

I suggest to add another transform:

"^.+\\.(t|j)sx?$": ["ts-jest", { isolatedModules: true }],

 

 

It might sharply decrease the execution time of jest tests.

In our case, this change reduces execution time from 20-40s* to 10s (34 test suites, 140 tests on Apple m1 chip)

* 40s only in case when jest runs tests without starting from the slowest one. Usually it takes 20-25s

1 REPLY 1

imsingh
Dynatrace Advisor
Dynatrace Advisor

I'll let the team know about this and then we'll update the docs if necessary. 

Featured Posts