Minimal TAP-producing test harness for Node.js and browsers
open sourceMITfree
tape is a small test harness for JavaScript that runs in Node.js and in browsers and prints its results in the Test Anything Protocol (TAP). Tests are plain functions given an assertion object, with plan counts, async and promise-returning tests, teardown hooks, timeouts and a set of strict and loose equality and deep-equality assertions. A tape command runs test files by glob, with flags to preload modules, ignore files and fail on a leftover .only. It keeps a minimal core: colourful output and other reporters come from separate modules that read its TAP output.
Problems it solves
- write simple unit tests for a Node.js module without a big test framework
- run the same JavaScript tests in Node and in the browser
- get test results as TAP output I can pipe into any reporter
Features
- Tests as plain functions with plan counts, async and promise-returning tests
- Strict and loose equality, deep-equality, throws and error assertions
- Results in the Test Anything Protocol (TAP), for any TAP reporter
- A tape command that runs test files by glob, with --require, --import, --ignore and --no-only flags
- Runs in Node.js and in browsers
- Teardown hooks, per-test timeouts and onFinish/onFailure callbacks
Alternatives
The same job
These do what tape does.
- Mocha Feature-rich JavaScript test framework for Node.js and the browser
- Jasmine Behaviour-driven JavaScript testing framework for browsers and Node.js
- Vitest Next generation testing framework powered by Vite
- Jest Delightful JavaScript Testing
- node-tap Test Anything Protocol test framework for JavaScript and TypeScript
- Nightwatch.js Node.js end-to-end testing framework on the W3C WebDriver API
