Registry / testing / tape
library1.0jsnpmunverified

TAP-producing test harness for Node.js and browsers. Current stable version is 5.9.0, released in July 2024. Tape is a minimal, dependency-light testing library that outputs standard TAP (Test Anything Protocol) format, making it compatible with many reporters and CI systems. It supports both CommonJS and ES modules in Node.js, works in browsers via bundlers, and includes built-in async/Promise support. Unlike heavier frameworks like Jest or Mocha, tape has no global state, no configuration, and a single assert API inspired by the Node.js assert module. It is unopinionated about test organization and does not require describe/it nesting; tests are simply functions. Tape is ideal for projects that want a simple, composable, and predictable test harness with minimal setup.

npm install tape
INSTALL
IMPORT
SIG · TAPE
T
tape
testingjavascriptv1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

test
import test from 'tape'
import { test } from 'tape'
tape's default export is a function. Named exports exist but are rarely used.
test
const test = require('tape')
const { test } = require('tape')
CommonJS require returns the test function directly. Destructuring will get a different export if any.
Test
import { Test } from 'tape'
The Test class is a named export, available for custom assertion extensions.

Shows synchronous and async tests with plan, assertions equal and ok.

import test from 'tape'; test('basic arithmetic', function(t) { t.plan(2); t.equal(1 + 1, 2); t.ok(true, 'this is true'); }); test('async test', async function(t) { t.plan(1); const result = await Promise.resolve(42); t.equal(result, 42, 'promise resolved correctly'); }); // Run: node test.js (or: tape test.js)
Debug
Known issues
breakingtape v5 dropped Node.js < 12 support and switched to ES modules internally
fix
Upgrade to Node.js >= 12, ensure CJS require pattern still works but check for any import/export changes.
affects: >=5.0.0
deprecatedtape v4 deprecated the 'skip' option on test function in favor of test.skip()
fix
Use test.skip(name, cb) instead of test(name, {skip: true}, cb)
affects: >=4.0.0 <5
gotchatape's 't.plan()' must match number of assertions; mismatch causes failure at test end
fix
Always call t.plan(count) where count equals all assertions (including nested callbacks). Use t.end() if plan is hard to predict.
affects: *
Errors
Common errors & fixes
TypeError: test is not a function
Incorrect import: using named import instead of default import in ES modules.
fix
Use `import test from 'tape'` (no curly braces).
AssertionError: plan !== count
t.plan() count does not match number of assertions executed.
fix
Ensure t.plan(N) matches the total expected assertions, or replace with t.end() for dynamic counts.
Upgrade
Version history
1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
tape — npm install tape · libregistry