uvu
uvu is an extremely fast and lightweight test runner for Node.js and the browser
Last updated 2 years ago by lukeed .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install uvu 
SYNC missed versions from official npm registry.
uvu
version CI downloads install size
uvu is an extremely fast and lightweight test runner for Node.js and the browser
Ultimate Velocity, Unleashed

example with suites

Features

  • Super lightweight
  • Extremely performant
  • Individually executable test files
  • Supports async/await tests
  • Supports native ES Modules
  • Browser-Compatible
  • Familiar API

Install

$ npm install --save-dev uvu

Usage

Check out /examples for a list of working demos!

// tests/demo.js
import { test } from 'uvu';
import * as assert from 'uvu/assert';

test('Math.sqrt()', () => {
  assert.is(Math.sqrt(4), 2);
  assert.is(Math.sqrt(144), 12);
  assert.is(Math.sqrt(2), Math.SQRT2);
});

test('JSON', () => {
  const input = {
    foo: 'hello',
    bar: 'world'
  };

  const output = JSON.stringify(input);

  assert.snapshot(output, `{"foo":"hello","bar":"world"}`);
  assert.equal(JSON.parse(output), input, 'matches original');
});

test.run();

Then execute this test file:

# via `uvu` cli, for all `/tests/**` files
$ uvu -r esm tests

# via `node` directly, for file isolation
$ node -r esm tests/demo.js

Note: The -r esm is for legacy Node.js versions. Learn More

View the uvu CLI documentation

Assertions

The uvu/assert module is completely optional.

In fact, you may use any assertion library, including Node's native assert module! This works because uvu relies on thrown Errors to detect failures. Implicitly, this also means that any uncaught exceptions and/or unhandled Promise rejections will result in a failure, which is what you want!

API

Module: uvu

View uvu API documentation

The main entry from which you will import the test or suite methods.

Module: uvu/assert

View uvu/assert API documentation

A collection of assertion methods to use within your tests. Please note that:

  • these are browser compatible
  • these are completely optional

Benchmarks

via the /bench directory with Node v10.21.0

Below you'll find each test runner with two timing values:

  • the took ___ value is the total process execution time – from startup to termination
  • the parenthesis value ((___)) is the self-reported execution time, if known

Each test runner's stdout is printed to the console to verify all assertions pass.
Said output is excluded below for brevity.

~> "ava"   took   594ms  (  ???  )
~> "jest"  took   962ms  (356  ms)
~> "mocha" took   209ms  (  4  ms)
~> "tape"  took   122ms  (  ???  )
~> "uvu"   took    72ms  (  1.3ms)

License

MIT © Luke Edwards

Current Tags

  • 0.5.6                                ...           latest (2 years ago)
  • 0.6.0-next.1                                ...           next (4 years ago)

50 Versions

  • 0.5.6                                ...           2 years ago
  • 0.5.5                                ...           2 years ago
  • 0.5.4                                ...           2 years ago
  • 0.5.3                                ...           3 years ago
  • 0.5.2                                ...           3 years ago
  • 0.6.0-next.1                                ...           4 years ago
  • 0.6.0-next.0                                ...           4 years ago
  • 0.5.1                                ...           4 years ago
  • 0.5.0                                ...           4 years ago
  • 0.5.0-next.1                                ...           4 years ago
  • 0.5.0-next.0                                ...           4 years ago
  • 0.4.1                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.3.5                                ...           4 years ago
  • 0.4.0-next.4                                ...           4 years ago
  • 0.3.4                                ...           4 years ago
  • 0.4.0-next.3                                ...           4 years ago
  • 0.3.3                                ...           4 years ago
  • 0.3.2                                ...           4 years ago
  • 0.4.0-next.2                                ...           4 years ago
  • 0.4.0-next.1                                ...           4 years ago
  • 0.4.0-next.0                                ...           4 years ago
  • 0.3.1                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.3                                ...           4 years ago
  • 0.2.2                                ...           4 years ago
  • 0.2.1                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.20                                ...           4 years ago
  • 0.0.19                                ...           4 years ago
  • 0.0.18                                ...           4 years ago
  • 0.0.17                                ...           4 years ago
  • 0.0.16                                ...           4 years ago
  • 0.0.15                                ...           4 years ago
  • 0.0.14                                ...           4 years ago
  • 0.0.13                                ...           4 years ago
  • 0.0.12                                ...           4 years ago
  • 0.0.11                                ...           5 years ago
  • 0.0.10                                ...           5 years ago
  • 0.0.9                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.7                                ...           5 years ago
  • 0.0.6                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
  • 0.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (4)

Copyright 2013 - present © cnpmjs.org | Home |