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

Significantly slower tests in pipelines on Node 22 #7302

Open
6 tasks done
bakasmarius opened this issue Jan 20, 2025 · 6 comments
Open
6 tasks done

Significantly slower tests in pipelines on Node 22 #7302

bakasmarius opened this issue Jan 20, 2025 · 6 comments

Comments

@bakasmarius
Copy link

bakasmarius commented Jan 20, 2025

Describe the bug

We have a NestJS backend project (~20k LOC) with 652 tests in 199 test files.
It's a mix of unit and integration tests (nothing fancy, just RabbitMQ and PostgreSQL).
We finally got a chance to upgrade from Node 20 to Node 22 but we noticed that tests are taking ~10 times more time to run on Bitbucket Pipelines (we use 8x size) after simply changing the image from node:20.18.1-alpine3.21 to node:22.13.0-alpine3.21.
We are also in the process of migrating from Bitbucket to Gitlab, the difference in Gitlab between node versions is only ~+35% (~2 minutes), but the total time is quite similar.
There is no significant difference between node versions when running tests locally on Windows or Mac laptops.
There is also no significant difference between running tests using vitest v2 or v3.
I also tried running the tests on the newest Node 23, the numbers are basically the same as with Node 22.
Here is a table of time differences (Mac times are approximated as they came from my coworker):

  Node: 20.18.1 Node: 22.13.0 Diff (seconds) Diff (%)
Windows 11 laptop (32 GB RAM) 160 179 19 11.88%
Mac M1 laptop 60 60 0 0.00%
Mac M4 laptop 40 40 0 0.00%
Bitbucket Pipelines Self-Hosted 330 328 -2 -0.61%
Bitbucket Pipelines 8x 52 574 522 1003.85%
Bitbucket Pipelines 4x 116 579 463 399.14%
Bitbucket Pipelines 2x 286 765 479 167.48%
Bitbucket Pipelines 745 869 124 16.64%
Gitlab Pipelines 379 509 130 34.30%

Is this expected? Maybe someone else had the same experience and knows if there's something we can do to keep the numbers lower?

Reproduction

System Info

Node: 20.18.1 vs. 22.13.0
Windows 11 / MacOS
Bitbucket Pipelines
Gitlab Pipelines

Used Package Manager

npm

Validations

@sheremet-va
Copy link
Member

Can you check if fixes from #7285 work for you?

@AriPerkkio
Copy link
Member

That likely won't help as summary is disabled on CI.

I would recommend to try narrowing down the exact Node versions where the slowness starts coming up and then check the Node release notes for that. Is it happening on 22.0.0 too or just the mentioned 22.13.0?

@bakasmarius
Copy link
Author

@sheremet-va no, as @AriPerkkio correctly stated, summary is disabled on CI, although I managed to speed up my local tests by replacing dot reporter with default reporter 🙂

@AriPerkkio good idea!! I made some tests and looks like the change happened with Node 22.12.0 - I guess enabling require(esm) by default might probably be the cause of it
https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V22.md#2024-12-03-version-22120-jod-lts-ruyadorno

Copy link

github-actions bot commented Feb 2, 2025

Hello @bakasmarius. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.

@bakasmarius
Copy link
Author

@hi-ogawa I am not sure what kind of reproduction I could provide, could you elaborate, please?
I am of course not able to share the repo from my work, but I guess any open-source repo with a couple hundred of tests would do. Even tests from vitest repo should suffice.

@hi-ogawa
Copy link
Contributor

hi-ogawa commented Feb 4, 2025

On our CI, there doesn't seem to be a significant gap between Node 20 vs 22. So at the moment, I don't think we have any idea what to tackle. We need a reproduction for the issue to be actionable and otherwise, we need to move on and prioritize other issues for now.

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

No branches or pull requests

4 participants