Skip to content
Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time

Node.js CI



  • Simple - zero-config, no API to learn, out of the box ESM/CJS support
  • Lightweight - 6kB and no dependencies
  • Magical - simply export test functions, that's all
  • Blazingly fast - with almost zero abstractions, xv is as fast as Node
  • Unix philosophy™ - do one thing well, xv is only a test runner

Used by lowdb (local JSON database), steno (fast file writer) and other awesome projects.


npm install xv --save-dev


Create a test file and use Node's built-in assert module:

// src/add.test.js
import { strict as assert } from 'assert'
import add from './add.js'

// This is plain Node code, there's no xv API
export function testAdd() {
  assert.equal(add(1, 2), 3)

Edit package.json:

  "scripts": {
    "test": "xv src"

Run all test files:

npm test

Run a single test file:

npx xv src/add.test.js 


When provided with a directory, xv will look for files named *.test.js or test.js and run exported functions sequentially.


To test TypeScript code, compile your .ts files and run xv on compiled .js files.

For example, assuming your compiled files are in lib/, edit package.json to run xv after tsc:

  "scripts": {
-   "test": "xv src"
+   "test": "tsc && xv lib"

If you're publishing to npm, edit package.json to exclude compiled test files:

  "files": [
+   "!lib/**/*.test.js",
+   "!lib/**/test.js"

Common JS

xv can also test CJS code.

// src/add.test.js
const assert = require('assert').strict;
const add = require('./add')

// This is plain Node code, there's no xv API
exports.testAdd = function() {
  assert.equal(add(1, 2), 3)

Watch mode

xv doesn't integrate a watch mode. If the feature is needed, it's recommended to use tools like watchexec or chokidar-cli to re-run xv when there are changes.


The project being very simple by design, there probably won't be frequent updates to the code (which is a good thing for you, unless you like Dependabot alerts and updating devDependencies). It will be updated to support latest Node releases and implement potential improvements.

tl;dr xv is maintained and used, even though code updates may not be recent.