-
Notifications
You must be signed in to change notification settings - Fork 1.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
ci: fix jest memory flakiness #18859
Conversation
New dependency changes detected. Learn more about Socket for GitHub ↗︎ 👍 No new dependency issues detected in pull request Bot CommandsTo ignore an alert, reply with a comment starting with Pull request alert summary
📊 Modified Dependency Overview:
|
CodSpeed Performance ReportMerging #18859 Summary
|
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.
Interesting PR 👀
I didn't try it running it, though it looks good to me
My goal is to be able to transpile esm and cjs modules via jest, while also keeping the performance good. As it turned out, I tried to flip this switch by transpiling
node_modules
recently and that made our CI unstable because transpiling is expensive on memory. With@swc/jest
it's kinda all or nothing unless we can dynamically craft a regex that includes esm modules to be transpiled - that's not ideal.https://www.notion.so/prismaio/Findings-on-flaky-tests-de5b979a8441402784ae6eedd270f9dd?pvs=4#4218c00bcb304675a1e9671372de3d6c
Goals
So 3 goals for me: reasonable heap growth, good performance, and esm transpilation. Here's some rough benchmarks on my machine via
pnpm jest --clearCache && pnpm run test:functional --provider postgresql
(+--logHeapUsage --runInBand
).Benchmarks
main
(jest.config.js
)Details
main
(jest.config.js
)Details
jest.config.js
)Notice how we don't manage
transformIgnorePatterns
anymore.Details
Result summary
As you can see
How the solution works
I couldn't meet all my requirements with current tooling.
So I implemented a
jest
transformer foresbuild
that actually works and does what I needed.esbuild
is equivalent@swc/jest
in terms of performance/cpu usage.@swc/jest
, but also has smaller footprint.Some more runs but on multiple cores (8)