junit-merge is a Node.js command-line interface (CLI) tool designed for consolidating multiple JUnit XML test reports into a single, unified XML file. This is particularly useful in CI/CD environments where parallel test runners generate numerous individual report files that need to be aggregated for a comprehensive overview or integration with other reporting systems. The current stable version is 2.0.0. While the package doesn't specify a formal release cadence, updates are typically driven by Node.js compatibility changes or new feature requirements. Its primary differentiator is its simplicity and focus as a dedicated CLI for this specific task within the Node.js ecosystem, allowing for easy integration into build scripts without requiring complex programmatic setups. It supports features like merging all results in a directory, recursive directory merging, and specifying an output file.
npm install junit-mergeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `junit-merge` CLI to combine multiple JUnit XML reports from a directory into a single output file using Node.js's `child_process` module. It includes setup for dummy reports and cleanup.
Upgrade your Node.js runtime to version 6, 8, 10, or a more recent compatible LTS version (e.g., `nvm install 16` or `nvm use 16`).
Prefer using `junit-merge` via `child_process.execSync` or `spawn` within Node.js scripts for reliable integration, mirroring its CLI usage, rather than attempting direct module imports.
Validate the integrity and format of source XML files before running `junit-merge`. Consider adding a pre-processing step to check XML validity if file sources are untrusted.
Install the package globally using `npm install -g junit-merge` or ensure your PATH includes the directory where npm installs global packages.
Ensure the input directory specified by `-d` exists before running the command, or use the `-C` (create directory) option if you expect the output directory to be created, though this option is for the *output* directory, not input.
Inspect the specified XML file (`path/to/malformed.xml`) for syntax errors, missing tags, or incorrect encoding. Ensure all input files adhere to the JUnit XML schema.
No dependency data recorded yet.