3 ms·
Tests are run single-threaded currently. bun:test is fast mostly because it’s integrated deeply into the runtime. Other test runners typically have to mutate g
by Jarred 4y ago
Tests are run single-threaded currently.
bun:test is fast mostly because it’s integrated deeply into the runtime. Other test runners typically have to mutate globals and spend a lot of time setting up the environment and tearing it down. Also, expect() in bun:test is something like 10x faster[1] than in vitest (100x jest) because it’s written in native code.
Test runners involve a lot of polymorphism which means JS doesn’t get JIT’d much — in cases like that, writing in native is much faster.
Another factor is transpilation time. bun:test supports TypeScript and JSX without plugins and bun’s transpiler is very fast
[1]: https://twitter.com/jarredsumner/status/1595681235606585346?s=46&t=0Uhw6mmGT650_9M2pXUsCw https://twitter.com/jarredsumner/status/1595681235606585346?...