tapcolorize-formatter
v1.0.4
Published
Colorize TAP results.
Maintainers
Readme
tapfmt
Pretty-print TAP (v13) as spec output or JSON.
Install
bun add tapfmtCLI:
bun add -g tapfmtor bunx tapfmt.
Example
This repo uses brittle as the TAP producer and formats it with tapfmt:
bun examples/demo.js | bunx tapfmtSame thing via scripts:
bun run example
bun run test:fmtexamples/demo.js covers pass, fail, skip, and todo. A saved TAP stream works the same:
cat test/fixtures/example.txt | bunx tapfmt
Formats
spec(default)json
cat results.tap | tapfmt -f jsonLibrary
import { parse, SpecFormatter, JsonFormatter } from "tapfmt";
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));Why
TAP is a cross-language protocol. Formatters usually are not — they ship tied to one runtime. tapfmt is a CLI and a TypeScript library you can pipe any TAP stream into.
bun examples/demo.js | tapfmt
bun run test | tapfmt
cat results.tap | tapfmtLicense
MIT
