npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

prettytap

v0.2.0

Published

Pretty-print TAP results.

Readme

prettytap

Pretty-print TAP (v13) as spec output or JSON.

Install

npm install prettytap

CLI:

npm install -g prettytap

or npx prettytap.

Example

This repo uses brittle as the TAP producer and formats it with prettytap:

node examples/demo.js | npx prettytap

A saved TAP stream works the same:

cat test/fixtures/example.txt | npx prettytap

spec output

Exit code

A pipe only returns the formatter's status, so a runner that crashes after printing a clean TAP stream (an uncaught error on stderr, a non-zero exit) is invisible to runner | prettytap. Let prettytap spawn the runner instead:

prettytap -- brittle-node test/all.mjs
prettytap -f json -- bare test/all.ts

The runner's stderr passes through. prettytap exits non-zero when the TAP stream fails or the runner exits non-zero, whichever happens.

Formats

  • spec (default)
  • json
cat results.tap | prettytap -f json

Library

const { parse, SpecFormatter, JsonFormatter } = require('prettytap')

const results = parse(`TAP version 13
1..2
ok 1 test 1
not ok 2 test 2
`)

const spec = new SpecFormatter()
console.log(spec.formatToString(results))
console.log(spec.summaryToString())

const json = new JsonFormatter()
console.log(JSON.stringify(json.toJson(results), null, 2))

API

const results = parse(input)

Parse a complete TAP string (or array of lines) into a results object.

const parser = new Parser()

Incremental parser for a TAP stream.

  • parser.write(chunk) — feed a chunk, returns an array of events
  • parser.end() — flush the trailing line, returns any remaining events
  • parser.results — the results object, updated in place

Events are { type: 'test', test }, { type: 'yaml', test }, { type: 'comment', text } and { type: 'bail', reason }.

isPassing(results)

Whether every expected test passed. Also available as results.isPassing().

resultsToString(results)

Plain-text summary of a results object. Also available as results.toString().

const formatter = new SpecFormatter()

  • formatter.formatToString(results) — the spec body
  • formatter.summaryToString() — the totals, after formatToString
  • formatter.format(results) / formatter.summary() — the same, written to stdout

Streaming, for use with Parser events:

  • formatter.streamStart(results) — reset for a new stream
  • formatter.streamTest(test) / streamYaml(test) / streamBail(reason) — return a string
  • formatter.streamComment(text) — record the next suite heading

const formatter = new JsonFormatter()

  • formatter.toJson(results) — a plain object
  • formatter.formatToString(results) — the same, stringified
  • formatter.format(results) — the same, written to stdout

formatSpec(results) / formatJson(results)

One-shot helpers that construct a formatter, print, and return it.

Colors

bold, faint, dim, italic, underline, red, green, yellow, blue, magenta, cyan, brightRed, brightMagenta, plus stripAnsi(str), isColorEnabled() and setColorEnabled(enabled). Color is off when stdout is not a TTY, or with NO_COLOR / --no-color, and forced on with FORCE_COLOR / --color.

Why

TAP is a cross-language protocol. Formatters usually are not — they ship tied to one runtime. prettytap is a CLI and a library you can pipe any TAP stream into.

node examples/demo.js | prettytap
npm test | prettytap
cat results.tap | prettytap

License

MIT