-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: the jest tests performance dropped badly from node 14 to 19 #13904
Comments
I'm currently in the process of upgrading a project to node 18 and jest 29 and noticed a similar drop in performance on newer node versions. Our specs: jest config: module.exports = {
testEnvironment: "jsdom",
testEnvironmentOptions: {
url: "http://localhost"
},
setupFiles: ["core-js", "<rootDir>/tests/setup"],
setupFilesAfterEnv: [
"<rootDir>/tests/matchers.ts",
"<rootDir>/tests/jsdomPatch.js",
"<rootDir>/enzyme.config.js"
],
testMatch: ["**/*.spec.(js|ts|jsx|tsx)"],
moduleFileExtensions: ["js", "json", "ts", "jsx", "tsx"],
moduleNameMapper: require("./aliases.config").jest,
coverageDirectory: "<rootDir>/coverage",
coverageReporters: ["html", "json", "cobertura"],
reporters: [
"default"
],
transformIgnorePatterns: [
"node_modules/(?!(react-grid-layout/css|react-resizable/css|lodash-es|nanoid)/)"
],
testResultsProcessor: "jest-sonar-reporter"
}; Environment Test Performance node 14.18.1 node 18.14.2 |
Not sure if this is relevant, but the issue may be coming from node itself: nodejs/node#45662 |
We are also facing the same issue while updating from node 12 to node 19 |
Same issue, updated node 12 -> 18 and Jest 26 -> 27. We have about 1000 test suites, time of testing on Jenkins CI went from 10 minutes to 23 minutes. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
I recently got a new dev machine and wanted to re-run jest + webpack on versions 14/16/18 of nodejs. new machine specs: Below are the updated results:
Note: none of the source code or npm packages were changed between runs. On cold runs, I did delete cached webpack artefacts. From node 14 to 18, our jest tests ran 27% slower while our webpack build was 18% faster. This leads me to believe that the issue is not solely with node itself but some interaction between node + jest. Let me know if there is any other information that you need. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
So, jest has a huge community, but nobody is interested in performance?!? |
duplicate of #11956 I expect |
jest 29.5.1, node 16.10 -> 18.16 at github actions runner with
|
Hi, same here. Any solution? |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Same thing. A huge drop of performance. I've used Angular 12 with jest 26 and CI and node 16 and tests run 5 minutes. Now I'm using Angular 15 with jest 29 and Node 18 and I'm getting 10-11 minutes with the same pack of tests. |
From Node 16.4.2 to 16.14.0 or any newer version makes our current suit go from 20~ to 50+ seconds to run. |
Same here. Upgraded from Node14 to Node18 and unit tests now take >250s when they used to take just 70s |
Has anyone resolved this issue? I have 350~ passing tests in node 14 and switching to node 16 or 18 causes my tests to take forever and failures start happening |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This is a duplicate of #11956 follow that incident for updates - tldr light is at the end of the tunnel - there is a pr that fixed node js |
Most of the comments in this issue is indeed a duplicate of #11956. But this from the OP doesn't seem like the same thing:
|
I have a similar issue, migrating from node 18 to 20, tests are 2x slower, we have a lot of tests in our app with jsdom, I also tried jest 30.0.0 alpha1 in order to use jsdom 22 but doesn't seem to improve the situation. here are some benchmarks: Node 18: 587s On the CI: |
Do you have a reproduction for this somehow? And can you try with Node 21, that should have some good improvements (but not related to regression between 18 and 20) |
Thank you @SimenB ! Node 21 works much better: node21 80% workers: 436s So even better than node 18, and it's scaling much better with the number of workers, which is great news! For now we'll postpone the migration I think, as we want to stay on LTS versions only on our CI environments. |
Just want to note that the fix from Node 21 made it into Node 20.10.0. My unit test runtime dropped by 50% with this fix. |
I also wanted to note that this node version has restored performance back to the v14 levels, the updated benchmarks for my project: node: 14.21.3 node: 20.10.0 |
🎉 |
Version
29.4.2
Steps to reproduce
I have a suite of
2158
tests distributed in396
files - actually, we have more that we decided to skip in the CI because of the actual issue.Each test requires some imports, and some of them are done globally, via
setupFiles
and some are imported via the tests.The total import size per test file is around
20MB
.We were using
node 14
in our ecosystem, but because of some other factors, we decided to upgrade to the latest node version (19). Doing so we quickly noticed that our CI time for the jest tests more than doubled.Those being said we start measuring our suite against multiple node versions. All tests were done multiple times on each node version with --no-cache enabled, in order to get the most accurate readings.
Node 14 - 60s
Node 16 - 90s
Node 18 - 120s
Node 19 - 160s
For exact versions of node here is the detailed list.
The npm command used for running the tests
jest-test.config.js
Another important fact is that the jsdom was locked to 16.4.0 as this affects all the test suites.
Expected behavior
Performance to not decrease like that over upgrading the node version.
Actual behavior
The performance between node 19 and node 14 is almost 3 times worse.
Additional context
As this comes from a real project we can't offer additional context at the given time.
Environment
The text was updated successfully, but these errors were encountered: