Skip to content
A simple, terse, in-process reporter for the tape test runner for Node.js.
JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows
test
.eslintrc.json
.gitignore
.markdownlint.json
.npmignore
LICENSE
README.md
index.js
package.json

README.md

tape-player

A simple, terse, in-process reporter for the tape test harness for Node.js.

But why tho?

The Test Anything Protocol (TAP) used by many test harnesses is versatile, but it's not much to look at - or rather, it's too much to look at. There are many custom formatters that work with the tape test harness, but most work by piping process output. This is a useful technique, but interferes with the exit status of the test harness which is a problem in scripts that are meant to fail when tests fail (like npm test). (Though there are workarounds for this, they are shell- and platform-specific.)

Fortunately, tape offers an alternative logging mechanism via its createStream API. This technique is easy to use and runs in-process so it doesn't interfere with the exit status of the test harness. tape-player takes advantage of this to produce a concise test log that's easy to enable.

Hook me up!

Install tape-player via:

npm install tape-player --save-dev

And add it to one or more tape-based test files via:

require("tape-player")
// Ignore return value

That's it - run those tests and you'll see nicely formatted output on the standard output device!

tape-player works with the tape CLI or directly in tape-based files (as with node test-file.js).

Show me what you got...

Example output:

passing test
failing test
  /home/user/project/test/example.js:15:8
  Message:  oops
  Operator: fail
passing test

Tests:    3
Asserts:  5
Failures: 1
You can’t perform that action at this time.