Skip to content
Eugene Lazutkin edited this page Oct 8, 2024 · 4 revisions

tape-six is a TAP-based library for unit tests. It is written in the modern JavaScript for the modern JavaScript and works in Node, Deno, Bun and browsers.

It uses a familiar API for unit testing and supports browser-based and command-line testing, debugging and visualizing results.

How to use

  1. Install tape-six in your project: npm i -D tape-six.
  2. Write tests (see below).
  3. Configure your tests: set-up tests.
  4. Run tests: npm test (see tape6).

Example:

import test from 'tape-six';

test('Sample test', t => {
  t.ok(1 < 2, '1 is less than 2');
  t.deepEqual([1], [1], '[1] is equal to [1]');
});

Writing tests

To register a function as a test, use the test() function.

That function is called with a tester object as the first argument. See Tester for details.

Available utilities

Test files are directly executable with node or deno or bun or in a browser. Yet for a superior developer experience, a number of utilities are available:

  • tape6 for running tests.
  • tape6-server for serving files and running tests in a web server.
  • tape6-runner for helping writing custom shell scripts.

Check out the sister project: tape-six-proc — it runs tests in separate processes.

Notes on various environments

tape-six is used in different environments:

Formalities

The project is distributed under the 3-clause BSD license.

Other pertinent information: