Bun runs tests 1200% faster than Jest
... if your project has only 3 tests. More exactly, Jest runs these 3 tests in ~1.2s, while Bun runs them in a blazingly fast ~90ms.
I know this isn't at all representative of the real world, but running tests this fast was wild to me. It made Jest feel like a tired ol' man. Seeing the tests' results as soon as you press ENTER
was almost unbelievable to me, the first time I saw it. I thought it was a mistake, frankly.
So I'm excited!
Time to switch?
This made me wonder just how fast the tests we have at work would run, if we were to switch to Bun. Our suite of ~1000 tests takes about 20 minutes to run. Add 10 minutes to that, for the install, build, and lint steps.
That's a total of 30 minutes spent on every single commit! And the project isn't even that big.
Going from 20 minutes down to 75 seconds... That'd be a heck of an improvement!
It's not that easy...
Switching from a test runner to another isn't a trivial task.
But maybe ✨ AI ✨ can help with that? After all, this kind of "full-knowledge" repetitive task should be something that it excels at.
Of course, I'd first need to allocate some time to this venture. Then, read more about Bun's stability in production. Next, compare it with other sparkly test runners, like Vitest. Afterwards, do a prototype. Finally, start replacing the test runner in our monorepo, package by package.
So I'll keep this idea in the back of my mind, for now1.
-
It's a bit weird that I wrote this on Christmas day, but that's me, I guess? I'm just excited about my new, little blog :D. Anyways, merry Christmas, everyone! ❄️ ↩