Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge increase in test time since upgraded to jest 24 and new preset #242

Closed
blackholegalaxy opened this issue Mar 17, 2019 · 6 comments
Closed

Comments

@blackholegalaxy
Copy link
Contributor

Hi there, we have a medium sized project with around 1600 tests.

We upgraded yesterday to jest 24 with new preset, with recommended migrations changes. We use jsdom 13 as stated in the migration guide.

Please note no change was made to our project. On the same machine, here are the speed reports. It was run with jest alone, and reported result is the second launch of jest command (to ensure no cache problem or something like that).

Before, under jest 23:

Test Suites: 11 skipped, 169 passed, 169 of 180 total
Tests:       82 skipped, 1671 passed, 1753 total
Snapshots:   0 total
Time:        19.142s

After upgrading to new preset 7.0.1 and jest 24:

Test Suites: 11 skipped, 169 passed, 169 of 180 total
Tests:       82 skipped, 1671 passed, 1753 total
Snapshots:   0 total
Time:        29.138s

Attempt with jest 24 and old 6.0.2 preset (no jsdom 13):

Test Suites: 11 skipped, 169 passed, 169 of 180 total
Tests:       82 skipped, 1671 passed, 1753 total
Snapshots:   0 total
Time:        25.061s

Please note it's especially components which encounter that problem. Our most complete component went from 2s testing under jest 23 to more than 8 sec itself alone in jest 24/preset 7.0.2.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Mar 17, 2019

Hi, this had been addressed in #213. It is the result of switching to use AST transformer + some other things ts-jest 23.10.x does. It's most likely ts-jest issue.

@wtho
Copy link
Collaborator

wtho commented Mar 17, 2019

Here is a PR in ts-jest which might speed up the testing once merged. But it probably will stay a bit slower than v6.

From our side the newer version fixes several issues (like coverage accuracy), so we decided to publish it already. If you mostly care about speed, I personally suggest you to stay on v6 for now.

If you can provide a reproduction with an especially slow component, it would enable us to do more performance testing and we could try to speed up the AST transformation done by the preset, provided the slowdown is not caused by ts-jest.

@thymikee
Copy link
Owner

There's nothing this preset can do for you in terms of performance. However expect some speedup in the next minor version of Jest (24.6 or so) as we fixed some regressions.

@Ludevik
Copy link

Ludevik commented May 17, 2019

@blackholegalaxy tests in my project were super slow after upgrade too, but i enabled isolatedModules in ts-jest options and they were back to normal. See this link. It might help you, but it has its costs.

@tcrite
Copy link

tcrite commented Sep 20, 2019

@blackholegalaxy tests in my project were super slow after upgrade too, but i enabled isolatedModules in ts-jest options and they were back to normal. See this link. It might help you, but it has its costs.

This was a huge help! my unit test went from around 13 minutes to just over a minute when ran in my build pipeline on the server.

@blackholegalaxy
Copy link
Contributor Author

blackholegalaxy commented Sep 20, 2019

In our case it didn't change much. 2 seconds average on a 45s run basis. The fact is with jest 24+, we have like... 10 seconds where NOTHING happens. Then tests start normally. Even with test cache enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants