Tape is a TAP-producing test framework for Node.js that provides assertions, spies, subtests, and isolated test harnesses. It functions as both a test runner and an assertion library, outputting results in the Test Anything Protocol format for machine or human consumption.
The framework manages test execution through callback-based async control, plan-based auto termination, and subtest stack isolation. It includes a spy wrapper system that replaces object methods with call-recording wrappers that restore originals during teardown, along with a teardown callback registry that collects and executes cleanup functions after each test completes. Tape supports glob pattern file discovery for locating test files and module preloading hooks for transpiler setup.
The assertion library covers equality checks including deep, strict, and loose comparisons, exception assertions for verifying thrown errors, string pattern matching against regular expressions, and truthiness checks. Custom assertion creation allows user-defined validation logic, while test control features enable skipping individual assertions. The CLI provides file exclusion, focused test prevention for CI environments, and glob-based file selection.
Test lifecycle management includes explicit test completion signaling, assertion count planning, timeout enforcement, and hooks for test completion and failure events. The framework supports nested subtests that execute sequentially after parent completion, isolated harness instances with independent state, and streaming TAP output to pretty reporters.