Skip to content

Comparing the experience of using different testing libraries in javascript

Notifications You must be signed in to change notification settings

icetbr/comparing-testing-libraries

Repository files navigation

updated 2025-02-02, node 23.9.0

  • new PC
  • major simplification
  • using hyperfine for bench

Cold start times

./run.sh perf

ms runner ms runner
15.8 bun 134.8 tape
56.0 notest 220.2 mocha
57.4 best 259.5 lab
60.4 tehanu 580.1 ava
60.1 xv 654.4 vitest
61.2 zora 748.0 jest
66.3 uvu 1982.1 tap
71.2 node

Notes

  • some runners have no output, this makes them faster
  • best and notest are the fastest possible implementations, they are not actual libs.
  • bun is the fastest because it's native, written in Zig, while node is written in JS?
  • the slower runners use hot reloading (HMR), cold start doesn't matter when using in watch mode
  • in watch mode, some runners achieve "flicker free" reload
  • checkout some popularity stats like number of stars, montly downloads, commit activity and others. 1, 2

I need to retest watch mode, but mocha was a perfect 10 for me. The fastest frameworks are nearly as good, and vitest is as well. Vitest achieves it's "flicker free" by replacing the terminal content instead of clearing it between reloads.

My favorite runner

I'm trying out bun, with a custom reporter. It is the fastest and has a familiar syntax. Also I'm a minimalist, libraries with too many features tend to focus on things I don't really need. My testing needs are simple.

Vitest is the best one. It is the most active developed and the one with the brighter future, being backed by Evan You, the guy from Vue and VoidZero.

Usage

  1. clone
  2. npm install
  3. ./run.sh TARGET

Experiment by modifying run.sh. as need

Examples

./run.sh perf
./run.sh mocha
mode=equalError ./run.sh mocha # forces an assertion error

Contributing
License (MIT)

About

Comparing the experience of using different testing libraries in javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published