Colortape: Tape/node-tap Test Output Colorizer
Colortape is a command-line utility designed to add color to the test output of `tape` and `node-tap` JavaScript testing frameworks. It functions either as a direct wrapper for the test command, executing the test file and formatting its output, or by accepting the raw test output via a pipe. The package is currently at version 0.1.2, which was last published over seven years ago, indicating an abandoned status with no active development or maintenance. Its primary differentiator is its singular focus on colorizing output for these specific testing libraries, providing a simple, albeit unmaintained, solution for visual enhancement of test results without modifying the underlying test runners. Due to its abandonment, users should be aware of potential compatibility issues with newer Node.js versions or `tape`/`node-tap` releases, and the absence of security updates.
Common errors
-
sh: colortape: command not found
cause The `colortape` executable is not in your system's PATH, typically occurring when installed locally as a dev dependency but run globally.fixIf `colortape` is installed locally, run it via `npx colortape` or define an npm script in `package.json` (e.g., `"test": "colortape test/**/*.js"`) and run `npm test`. If you intend to use it globally, ensure it's installed with `npm install -g colortape`. -
(No color output appears in the terminal)
cause Color output might be suppressed due to the terminal environment not supporting ANSI escape codes, or if the output is being redirected where colors are automatically stripped.fixEnsure your terminal application is configured to support ANSI escape codes. If running in a CI/headless environment, check if `FORCE_COLOR=1` (a common environment variable for many colorizers) is needed, although `colortape` does not explicitly document support for it.
Warnings
- breaking The `colortape` package is abandoned, with the last update over seven years ago. This means there will be no future bug fixes, security patches, or compatibility updates for newer Node.js versions, `tape`, or `node-tap`.
- gotcha When using `colortape` via piping (`tape test.js | colortape`), the exit code of `colortape` itself will not reflect the success or failure of the `tape` tests. It will typically exit with `0` (success) if the piping operation itself was successful.
- gotcha `colortape` is not officially supported on Windows environments, and its behavior or stability cannot be guaranteed, as indicated in the documentation.
Install
-
npm install colortape -
yarn add colortape -
pnpm add colortape
Imports
- colortape
import colortape from 'colortape';
colortape test/foo.js
- colortape CLI (piped)
const colortape = require('colortape'); colortape.pipe(tapeOutput);tape test/foo.js | colortape
- colortape (internal utilities)
import { colorizeOutput } from 'colortape';N/A (no public API)
Quickstart
npm install --save-dev tape colortape
// --- test/basic.js ---
const test = require('tape');
test('simple synchronous test', function (t) {
t.plan(1);
t.ok(true, 'this assertion should pass');
});
test('another test', function (t) {
t.plan(2);
t.equal(1 + 1, 2, 'addition works');
t.notOk(false, 'negation works');
});
test('failing test example', function (t) {
t.plan(1);
t.equal('hello', 'world', 'this assertion should fail');
});
// -------------------
// Add to your package.json scripts:
// "scripts": {
// "test": "colortape test/basic.js"
// }
// Then run from your terminal:
// npm test
// Alternatively, run directly if installed globally or via npx:
// colortape test/basic.js