gitmyhub

xv

JavaScript ★ 824 updated 2y ago

🙅‍♀️ ✌️ fastest test runner

xv is a tiny test runner for JavaScript and TypeScript that finds your test files and runs plain Node.js code inside them. No special APIs, no config files, just name your functions test and go.

JavaScriptTypeScriptNode.jssetup: easycomplexity 1/5

xv is a minimalist test runner for JavaScript and TypeScript projects. A test runner is a tool that automatically executes your test files and reports whether your code behaves as expected. Instead of making you learn a complex framework with its own APIs and configuration files, xv just finds your test files and runs the plain Node.js code inside them.

The way it works is refreshingly straightforward. You write test files using standard naming conventions like add.test.js, and inside those files you use Node's built-in assert module to check that your functions return the right values. Any function whose name starts with test gets automatically picked up and executed. You point xv at a folder, it scans for files matching the naming pattern, and runs every exported test function it finds. There is no special test API to learn — it is just regular JavaScript.

This tool is built for developers and teams who are tired of wrestling with heavy testing frameworks. If you have ever spent an afternoon reading documentation just to figure out why your tests are not being discovered, or debugging a configuration file instead of writing actual tests, this is for you. It works well for small to medium projects, prototypes, or situations where you want to verify your code quickly without setting up a full testing infrastructure. It supports both modern ES modules and older CommonJS styles, and it handles TypeScript with a minor setup tweak.

What makes the project notable is its extreme focus on simplicity. The entire codebase is about 80 lines of TypeScript, which explains why it is exceptionally fast and has virtually no configuration overhead. The tradeoff is that it intentionally lacks features some developers expect, such as a watch mode that re-runs tests automatically when files change. The author suggests pairing it with an external file-watching tool if you need that functionality. The philosophy is clear: do one thing well, get out of the way, and let you focus on your code.

Where it fits