Awesome Open Source
Awesome Open Source



  • User-friendly - zero-config, no API to learn, simple conventions
  • Extremely lighweight - 40 LOC and no dependencies
  • Super fast - with almost zero abstractions, xv is as fast as Node

Used in lowdb, steno and other awesome projects. Supports ESM and TypeScript.


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'

export function testAdd() {
  assert.equal(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 a directory, xv will look for files named *.test.js or test.js and run exported functions sequentially.


To use xv with TypeScript, compile your .ts files and run xv directly on compiled .js. This has the benefit of testing code that is really published.

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.jsonto exclude compiled test files:

  "files": [

You can run npm publish --dry to check that it's working (nothing is going to be published with the --dry option).

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Javascript (1,513,839
Typescript (252,937
Node (12,583
Jest (3,557
Test (2,681
Tdd (1,542
Mocha (1,129
Minimalist (410
Esm (252
Runner (240
Related Projects