jest-preset-angular icon indicating copy to clipboard operation
jest-preset-angular copied to clipboard

Tests Speed - Share Thread

Open Twista opened this issue 7 years ago • 4 comments

Hello Everyone,

First, thanks for great lib, we are using it for a while and it has been big speedup.

Talking about the speed, I found some of our tests are bit slower then we expect (we could get used to too much :D) and therefore I would like to know whats your test results.

Reason is simple, to compare and eventualy see if its worth to dig deeper. There could be some issues within our test cases, or anything not realted. Hope no-one minds to have (at least for while topic like that)

To kick off, there are ours results, code-base has about 20k LOC (about 20-30% is HTML in templates, cuz not all has separate file for), and coverage is little under 70%

Test Suites: 122 passed, 122 total
Tests:       9 skipped, 326 passed, 335 total
Snapshots:   1 passed, 1 total
Time:        188.756s

Tests were executed at CircleCI machine (not so powerfull), but some of tests took more than 10 sec (one took 30s)

Thanks for sharing your results!

Twista avatar May 21 '18 01:05 Twista

Hi @Twista, do you know what might be the causes which make those tests slow ? From what I observed was the tests which are related to create elements in JSDOM (like creating iframe or bootstrap modal in some of my test suites). Besides, there is an issue regarding to TestBed memory leak might slow down the tests too. The CI machine at my work is not so powerful like yours and yes I see the same things like yours.

ahnpnl avatar Jun 05 '18 07:06 ahnpnl

I'm executing 300 tests in as low as 40sec, however I have intermittent runs that occasionally go for as long as 5 minutes.

ronnyek avatar Oct 29 '19 16:10 ronnyek

Here are some of my stats:

Test Suites: 1 skipped, 109 passed, 109 of 110 total
Tests:       3 skipped, 370 passed, 373 total
Snapshots:   244 passed, 244 total
Time:        26.275s, estimated 123s
Ran all test suites.

I was running jest version 24.9.1 before and it was slow. I upgraded to 25.1.0 and first time it still felt slow (total time around 180 seconds). The above stats are for the second time I ran jest, which is much much better.

I am not sure why, but seems that after a fresh npm i my tests are slower the first time but don't take my word for it, try it for yourself!

bboydflo avatar Feb 26 '20 13:02 bboydflo

I am not sure why, but seems that after a fresh npm i my tests are slower the first time

@bboydflo This is expected, as Jest needs to transpile your source code in-flight. After second run, this code is cached, so it's noticeably faster

thymikee avatar Feb 26 '20 14:02 thymikee