Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time
December 9, 2022 10:26
October 21, 2021 22:42
December 16, 2022 22:08
December 17, 2022 20:12
June 6, 2021 05:14
October 21, 2021 23:11
August 31, 2021 02:10
August 31, 2021 00:44
January 30, 2023 06:15
December 17, 2022 20:13
December 17, 2022 20:13
December 9, 2022 09:54
June 25, 2021 16:02


Node.js CI install size

A tiny (~80 lines of TypeScript) test runner focused on simplicity and speed

$ xv ./src
src/add.test.js: 0.103ms
src/sub.test.js: 0.064ms

Extracted from lowdb. One of the fastest test runner according to this benchmark.


If you've used other test runners, you probably have spent a significant amount of time reading docs, configuring, maintaining and debugging them.

By being extremely simple, xv gets out of your way and lets you be productive faster. In fact, the whole project documentation fits in this page ;)


npm install xv --save-dev


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

// src/add.test.js
import assert from 'node:assert/strict'
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 tests:

npm test                # run all test files in ./src
npx xv src/add.test.js  # run a single test file


By default, xv will look for files named: *.test.js, test.js, *.test.ts and test.ts


With TypeScript + ts-node

npm install ts-node --save-dev
  "scripts": {
    "test": "xv --loader=ts-node/esm src"

With TypeScript only

Compile your .ts files using tsc 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": "tsc && xv lib"

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

  "files": [

Common JS

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

exports.testAdd = function() {
  assert.equal(add(1, 2), 3)

Watch mode

xv doesn't have 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.