-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
[Q] How to speed up Jest? #4453
Comments
I've been getting this same issue lately. Very simple tests are taking 6 seconds to run. If I'm in watch mode and add a file regex to run one, they run fast as expected. Running them together causes a slow down either in the test or the post/pre test. |
This question may be better suited for the Jest repo, but my best advice would probably be to disable the You can also try the newer version of If this occurred as a result of an update on our end (and not just an increase in app size), let us know! |
Thanks @Timer I'll find out how to disable |
@CharlieIGG you can remove the |
I'd be happy with 6s - I'm taking minutes to run one test!
|
@JeremyBradshaw7 mind creating a reproducible demo? |
Adding the following to my jest: {
"testEnvironment": "node"
} WITHOUT console.time src/server/services/authentication/__tests__/authentication.test.js:87
foo: 4383ms
console.time src/server/services/authentication/__tests__/authentication.test.js:103
bar: 4321ms WITH console.time src/server/services/authentication/__tests__/authentication.test.js:87
foo: 666ms
console.time src/server/services/authentication/__tests__/authentication.test.js:103
bar: 635ms |
@bugzpodder can't really do that without exposing the company's code, I'd have to reproduce the whole environment on a separate codebase with dummy code. Typescript transpilation is involved though - that may have something to do with it. The multi-minute delay is only first time I run the tests (in a session), run them again it takes a few seconds. |
Sorry to comment in a closed thread, but I just upgraded react-scripts from 1.4 to 2.0.4 and my test suite that was previously taking ~200ms to run now takes ~5000ms. Watching the output, I can see that it hangs on |
File a new issue please. Ideally reproducing project would also be helpful. |
I'll lock this one because we don't track closed stale issues, so if they are used for new problems then we'll never solve those problems. |
Is this a bug report?
No, it's a question.
The Question: How to speed up Jest?
Tests are running at a very slow pace
I currently have only three tests: Two tests that validate the initial state of my app, plus the default
'renders without crashing'
test that comes with CRA.My other tests look like so:
It takes 11.30 seconds (not ms) to run these tests. If I just test with the default CRA test it takes around 8 - 9 seconds.
What gives? How can I make tests run faster?
The text was updated successfully, but these errors were encountered: