{"id":42067,"library":"tap-junit","title":"tap-junit","description":"tap-junit is a CLI tool and module that converts TAP (Test Anything Protocol) output into JUnit XML format, primarily for CI/CD systems like Jenkins. Current stable version is 5.0.4, with occasional releases. It works with any TAP-producing test framework (tape, tap, etc.) and supports piping or file input. Key differentiators: lightweight, zero dependencies, customizable suite/class names, and pretty-printing option. Compared to alternatives like tap-xunit or tap2junit, tap-junit is simpler and more actively maintained.","status":"active","version":"5.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/dhershman1/tap-junit","tags":["javascript","test","tap","tape","xml","reporter","xunit","junit"],"install":[{"cmd":"npm install tap-junit","lang":"bash","label":"npm"},{"cmd":"yarn add tap-junit","lang":"bash","label":"yarn"},{"cmd":"pnpm add tap-junit","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; CommonJS require will fail unless using dynamic import.","wrong":"const tapJunit = require('tap-junit')","symbol":"default","correct":"import tapJunit from 'tap-junit'"},{"note":"The 'transform' function converts TAP string to JUnit XML string. Available as named export.","wrong":"","symbol":"transform","correct":"import { transform } from 'tap-junit'"},{"note":"The Stream is named 'TransformStream', not 'Transform'. It is a Node.js transform stream.","wrong":"import { Transform } from 'tap-junit'","symbol":"TransformStream","correct":"import { TransformStream } from 'tap-junit'"}],"quickstart":{"code":"import { execSync } from 'child_process';\n// Using CLI: pipe TAP output into tap-junit\nconst command = `echo 'TAP version 13\n1..1\nok 1 first test' | npx tap-junit -p`;\nconst result = execSync(command, { encoding: 'utf8' });\nconsole.log(result);\n// Programmatic usage\nimport { transform } from 'tap-junit';\nconst tapInput = `TAP version 13\n1..2\nok 1 - passing test\nnot ok 2 - failing test\n  ---\n  message: Assertion failed\n  severity: fail\n  ...\n`;\nconst junitOutput = transform(tapInput, { suite: 'My Suite', pretty: true });\nconsole.log(junitOutput);","lang":"typescript","description":"Shows both CLI pipe usage and programmatic transform with TAP input to JUnit XML conversion."},"warnings":[{"fix":"Upgrade Node.js to >=12 or stay on 3.x","message":"Version 4.x dropped support for Node.js < 12","severity":"breaking","affected_versions":">=4.0.0 <5.0.0"},{"fix":"Use import or dynamic import() instead of require.","message":"Version 5.x dropped support for CommonJS (require). Package is now ESM-only.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use --input <file> instead of --file.","message":"The --file flag is deprecated in favor of --input (or -i).","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Omit --output to print to stdout.","message":"If no output file is specified, results are printed to stdout. Do not combine with --output if you want terminal output.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the TransformStream class for piping TAP data.","message":"The transform function expects a string, not a stream. For streams, use the TransformStream.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'5.0.4':34 'activ':85 'altern':71 'anyth':17 'ci/cd':26 'cli':9 'compar':69 'convert':14 'current':30 'customiz':61 'depend':60 'differenti':57 'etc':49 'file':54 'format':23 'framework':46 'input':55 'javascript':87 'jenkin':29 'junit':3,6,21,80,94 'key':56 'lightweight':58 'like':28,72 'maintain':86 'modul':12 'name':63 'occasion':36 'option':68 'output':19 'pipe':52 'pretti':66 'pretty-print':65 'primarili':24 'print':67 'produc':44 'protocol':18 'releas':37 'report':92 'simpler':82 'stabl':31 'suite/class':62 'support':51 'system':27 'tap':2,5,15,43,48,74,79,89 'tap-junit':1,4,78 'tap-produc':42 'tap-xunit':73 'tap2junit':77 'tape':47,90 'test':16,45,88 'tool':10 'version':32 'work':39 'xml':22,91 'xunit':75,93 'zero':59","created_at":"2026-06-04T18:55:27.610837+00:00","updated_at":"2026-06-04T18:55:27.610837+00:00","problems":[{"fix":"Change to import statement or use dynamic import: const tapJunit = await import('tap-junit');","cause":"Using require() instead of import. tap-junit 5+ is ESM-only.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/tap-junit/index.js not supported."},{"fix":"Install locally: npm i -D tap-junit and use npx tap-junit or the full path to ./node_modules/.bin/tap-junit","cause":"tap-junit is not installed globally or not in PATH.","error":"Command 'tap-junit' not found"},{"fix":"Use: import { transform } from 'tap-junit';","cause":"Importing the default export instead of the named export 'transform'.","error":"TypeError: transform is not a function"},{"fix":"Import directly from 'tap-junit': import { transform } from 'tap-junit';","cause":"Wrong import path; there is no submodule 'tap-junit/transform'.","error":"Error: Cannot find module 'tap-junit/transform'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/dhershman1/tap-junit#readme","github":"https://github.com/dhershman1/tap-junit","docs":null,"changelog":null,"pypi":null,"npm":"tap-junit","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}