-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[code-infra] Increase JSDOM test parallelism #20179
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
Conversation
|
Deploy preview: https://deploy-preview-20179--material-ui-x.netlify.app/ Bundle size report
|
| command: pnpm test:unit:jsdom | ||
| command: | | ||
| # Fully saturate all the available CPUs by splitting the tests in 1 shard per CPU | ||
| pnpm exec concurrently "pnpm test:unit:jsdom --reporter=blob --shard=1/2" "pnpm test:unit:jsdom --reporter=blob --shard=2/2" || TEST_EXIT_CODE=$? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose circleci never implemented a proper way to detect cores 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I'm not mistaken, availableParallelism detects correct amount of logical CPUs in circle ci. just feels a bit like overkill to write a wrapper script for this.
We have 2 CPUs available for the medium resource class. But having the tests run serially cause a lot of underutiization.
We can fully saturate them instead by sharding our tests and have 2 runs in parallel.
This makes optimal use of the available resources and brings the runtime of this job down by ~35% and thus also the consumed credits. Which brings it right into the ballpark of our second slowest job (
test_browser). If we want we can increase resource class to medium+ and add another shard to dip below the runtime of that job.For the test output it works as follows:
--reporter=bloboverrides the configured reporters to a representation that can be pieced together withvitest run --merge-reportsinto what's configured by the vitest config:We make sure to propagate the exit code afterwards as to make the job fail.