Write automated unit tests for a JavaScript library and pipe the TAP output into a formatter like tap-spec.
Add browser-compatible tests to a frontend project without pulling in a large test framework.
Run test suites in CI using the tape CLI with file glob patterns.
Verify async code works correctly by using t.plan or async functions inside test callbacks.
Tape is a testing library for JavaScript that runs in both Node.js and web browsers. When you write automated tests for a JavaScript project, you need a way to define what the expected behavior is and then check whether your code actually does it. Tape lets you write those checks as simple function calls that verify equality, truthiness, or other conditions. The output format Tape uses is called TAP, which stands for Test Anything Protocol. TAP is a plain text format where each test result prints on its own line as either ok or not ok, along with a description. This plain format is easy to read in a terminal and easy to pipe into other tools. The README lists a variety of separate output packages that can take TAP and display it in a more colorful or visually organized way, such as tap-spec or tap-nyan. Tape keeps its core small. You write tests by calling a test function with a name and a callback, and inside that callback you call assertion methods like t.equal to compare values or t.ok to check that something is truthy. Tests run in the order they are defined, one at a time. You can also write asynchronous tests using async functions or by declaring how many assertions to expect with t.plan. To run tests, you can use the tape command-line tool, which accepts file patterns and a few flags, or you can run test files directly with Node. The library is MIT licensed and installable via npm.
← tape-testing on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.