Registry / testing / cucumber-json-merge

cucumber-json-merge

JSON →
library0.0.8jsnpmunverified

cucumber-json-merge is a utility designed for combining multiple Cucumber JSON test reports into a single, unified report. It functions as both a Node.js command-line interface (CLI) and an importable JavaScript library, primarily supporting CommonJS modules. The current stable version is 0.0.8, with recent updates indicating active maintenance, though without a strict release cadence. Its core functionality enables users to aggregate test results, which is particularly useful in CI/CD environments where tests might run in parallel or across different suites, producing fragmented reports. The package differentiates itself by offering both a direct CLI for quick usage and an API for programmatic integration into larger Node.js applications, building upon similar concepts found in `junit-merge`.

npm install cucumber-json-merge
INSTALL
IMPORT
SIG · CUCUMBER-JSON-MERG
C
cucumber-json-merge
testingjavascriptv0.0.8
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cucumberJsonMerge
✓ const cucumberJsonMerge = require('cucumber-json-merge');
✗ import cucumberJsonMerge from 'cucumber-json-merge';
The package is primarily designed for CommonJS module systems. Direct ESM 'import' syntax may not work out-of-the-box and could require a transpilation step or specific Node.js loader configuration.
mergeFiles
✓ const { mergeFiles } = require('cucumber-json-merge');
✗ import { mergeFiles } from 'cucumber-json-merge';
The `mergeFiles` function is exported as a property of the main CommonJS module. While destructuring is common in CJS, direct ESM named imports are not supported without specific configurations.
listJsonFiles
✓ const { listJsonFiles } = require('cucumber-json-merge');
✗ import { listJsonFiles } from 'cucumber-json-merge';
The `listJsonFiles` function is part of the main CommonJS module export. Attempting to use it with ESM 'import' syntax will likely result in an error.

This quickstart demonstrates how to use `cucumber-json-merge` as a library to list and merge Cucumber JSON report files programmatically. It sets up dummy report files in a temporary directory, performs the merge operation, and then cleans up.

const cukemerge = require('cucumber-json-merge'); const fs = require('fs'); const path = require('path'); // Create a temporary directory and dummy JSON files for demonstration const tempDir = './temp-cucumber-results'; fs.mkdirSync(tempDir, { recursive: true }); const report1 = [ { "uri": "features/feature1.feature", "elements": [{"name": "Scenario A", "steps": [], "id": "scenario-a"}] } ]; const report2 = [ { "uri": "features/feature2.feature", "elements": [{"name": "Scenario B", "steps": [], "id": "scenario-b"}] } ]; fs.writeFileSync(path.join(tempDir, 'report1.json'), JSON.stringify(report1, null, 2)); fs.writeFileSync(path.join(tempDir, 'report2.json'), JSON.stringify(report2, null, 2)); console.log('Created dummy reports in:', tempDir); // List JSON files in the directory (non-recursive) const files = cukemerge.listJsonFiles(tempDir, false); console.log('Found files to merge:', files); // Merge the found files const mergedResults = cukemerge.mergeFiles(files); console.log('--- Merged Cucumber JSON Report ---'); console.log(JSON.stringify(mergedResults, null, 2)); console.log('-----------------------------------'); // Clean up temporary files and directory fs.unlinkSync(path.join(tempDir, 'report1.json')); fs.unlinkSync(path.join(tempDir, 'report2.json')); fs.rmdirSync(tempDir); console.log('Cleaned up temporary directory:', tempDir);
cucumber-json-merge --version
Debug
Known issues
gotchaThe package is currently at version 0.0.8. While actively maintained, pre-1.0 versions may introduce breaking changes in minor or patch releases, though none are explicitly documented yet.
fix
Always review the changelog before upgrading to new versions and pin exact dependency versions in `package.json` to prevent unexpected behavior.
affects: <1.0.0
gotchaThe package is primarily built and documented for CommonJS (CJS) environments using `require()`. Attempting to use `import` statements for ESM modules may lead to errors or require additional configuration (e.g., `"type": "module"` in `package.json` and explicit file extensions) which is not officially supported by the package.
fix
Ensure your project uses CommonJS for `cucumber-json-merge` imports, or consider a transpilation step if integrating into an ESM-only codebase.
affects: >=0.0.1
gotchaA dependency (`mkdirp`) was updated due to a Snyk security vulnerability. While the fix is integrated, users should regularly run security audits (e.g., `npm audit`) on their projects to identify and address any transitive dependency vulnerabilities.
fix
Upgrade to the latest version of `cucumber-json-merge` (0.0.8 or newer) to ensure patched dependencies are used. Regularly run `npm audit`.
affects: <0.0.8
Errors
Common errors & fixes
Error: Cannot find module 'cucumber-json-merge'
The package has not been installed or is not accessible in the current project's `node_modules`.
fix
Run `npm install cucumber-json-merge` in your project directory, or `npm install -g cucumber-json-merge` if using the CLI globally.
cucumber-json-merge: command not found
The CLI tool is not in your system's PATH. This typically happens if it was not installed globally or the global `node_modules` bin directory is not in PATH.
fix
Install the package globally using `npm install -g cucumber-json-merge` or ensure your shell's PATH includes the global npm binary directory.
Merged report is empty or incomplete
The input directory or specified files did not contain valid Cucumber JSON reports, or the file paths were incorrect.
fix
Verify that the input JSON files are valid Cucumber reports and that the paths provided to the CLI (`-d` or direct file arguments) or library (`listJsonFiles`) are correct and accessible.
No output file created (when using CLI)
When using the CLI, the `--out` or `-o` option was not specified, and the command might have only printed to stdout.
fix
Use the `-o <filename>` option to specify an output file, e.g., `cucumber-json-merge report1.json report2.json -o merged-results.json`.
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources