🧪
Testing200K+/wkISC

tap

tap (Test Anything Protocol) is a comprehensive test framework for Node.js that produces output conforming to the Test Anything Protocol, a language-agnostic fo

Installation

npm
npm install -D tap
yarn
yarn add -D tap
pnpm
pnpm add -D tap

Import

ESM
import t from 'tap';

Quick Example

usage
import t from 'tap';

t.test('basic arithmetic', (t) => {
  t.equal(1 + 2, 3, 'addition works');
  t.same({ a: 1 }, { a: 1 }, 'objects match');
  t.end();
});

About tap

tap (Test Anything Protocol) is a comprehensive test framework for Node.js that produces output conforming to the Test Anything Protocol, a language-agnostic format for test result reporting. tap provides a batteries-included testing experience with built-in assertion methods, subtests for organizing test hierarchies, lifecycle hooks, code coverage via V8 or Istanbul, TypeScript support without additional configuration, and snapshot testing. The framework runs each test file as a separate child process for complete isolation, preventing test pollution and enabling true parallel execution with configurable concurrency. tap's assertion methods include t.equal, t.same (deep equality), t.match (partial matching with patterns), t.throws, t.resolves, and t.rejects. The framework supports plugins for extending functionality and provides a --watch mode that re-runs tests on file changes. tap's TAP format output is machine-parseable, enabling integration with any TAP consumer for custom reporting. The framework was created and is maintained by Isaac Z. Schlueter, the creator of npm, and follows a philosophy of simplicity and correctness. tap is particularly popular in Node.js core development and package author communities.

Quick Facts

Packagetap
CategoryTesting
Weekly Downloads200K+
LicenseISC
Installnpm install -D tap

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.