{"id":13032,"library":"cucumber-json-merge","title":"Cucumber JSON Report Merge Utility","description":"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`.","status":"active","version":"0.0.8","language":"javascript","source_language":"en","source_url":"https://github.com/bitcoder/cucumber-json-merge","tags":["javascript","cucumber","reports"],"install":[{"cmd":"npm install cucumber-json-merge","lang":"bash","label":"npm"},{"cmd":"yarn add cucumber-json-merge","lang":"bash","label":"yarn"},{"cmd":"pnpm add cucumber-json-merge","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import cucumberJsonMerge from 'cucumber-json-merge';","symbol":"cucumberJsonMerge","correct":"const cucumberJsonMerge = require('cucumber-json-merge');"},{"note":"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.","wrong":"import { mergeFiles } from 'cucumber-json-merge';","symbol":"mergeFiles","correct":"const { mergeFiles } = require('cucumber-json-merge');"},{"note":"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.","wrong":"import { listJsonFiles } from 'cucumber-json-merge';","symbol":"listJsonFiles","correct":"const { listJsonFiles } = require('cucumber-json-merge');"}],"quickstart":{"code":"const cukemerge = require('cucumber-json-merge');\nconst fs = require('fs');\nconst path = require('path');\n\n// Create a temporary directory and dummy JSON files for demonstration\nconst tempDir = './temp-cucumber-results';\nfs.mkdirSync(tempDir, { recursive: true });\n\nconst report1 = [\n  {\n    \"uri\": \"features/feature1.feature\",\n    \"elements\": [{\"name\": \"Scenario A\", \"steps\": [], \"id\": \"scenario-a\"}]\n  }\n];\nconst report2 = [\n  {\n    \"uri\": \"features/feature2.feature\",\n    \"elements\": [{\"name\": \"Scenario B\", \"steps\": [], \"id\": \"scenario-b\"}]\n  }\n];\n\nfs.writeFileSync(path.join(tempDir, 'report1.json'), JSON.stringify(report1, null, 2));\nfs.writeFileSync(path.join(tempDir, 'report2.json'), JSON.stringify(report2, null, 2));\n\nconsole.log('Created dummy reports in:', tempDir);\n\n// List JSON files in the directory (non-recursive)\nconst files = cukemerge.listJsonFiles(tempDir, false);\nconsole.log('Found files to merge:', files);\n\n// Merge the found files\nconst mergedResults = cukemerge.mergeFiles(files);\nconsole.log('--- Merged Cucumber JSON Report ---');\nconsole.log(JSON.stringify(mergedResults, null, 2));\nconsole.log('-----------------------------------');\n\n// Clean up temporary files and directory\nfs.unlinkSync(path.join(tempDir, 'report1.json'));\nfs.unlinkSync(path.join(tempDir, 'report2.json'));\nfs.rmdirSync(tempDir);\nconsole.log('Cleaned up temporary directory:', tempDir);\n","lang":"javascript","description":"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."},"warnings":[{"fix":"Always review the changelog before upgrading to new versions and pin exact dependency versions in `package.json` to prevent unexpected behavior.","message":"The 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.","severity":"gotcha","affected_versions":"<1.0.0"},{"fix":"Ensure your project uses CommonJS for `cucumber-json-merge` imports, or consider a transpilation step if integrating into an ESM-only codebase.","message":"The 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.","severity":"gotcha","affected_versions":">=0.0.1"},{"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`.","message":"A 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.","severity":"gotcha","affected_versions":"<0.0.8"}],"env_vars":null,"search_vec":"'0.0.8':51 'across':87 'activ':56 'aggreg':70 'api':108 'applic':115 'build':116 'cadenc':63 'ci/cd':78 'cli':36,102 'combin':15 'command':33 'command-lin':32 'commonj':44 'concept':119 'core':65 'cucumb':1,7,17,126 'cucumber-json-merg':6 'current':47 'design':13 'differ':88 'differenti':95 'direct':101 'enabl':67 'environ':79 'found':120 'fragment':91 'function':27,66 'import':39 'indic':55 'integr':111 'interfac':35 'javascript':40,125 'json':2,8,18 'junit':123 'junit-merg':122 'larger':113 'librari':41 'line':34 'mainten':57 'merg':4,9,124 'might':82 'modul':45 'multipl':16 'node.js':31,114 'offer':98 'packag':94 'parallel':85 'particular':75 'primarili':42 'produc':90 'programmat':110 'quick':104 'recent':53 'releas':62 'report':3,20,25,92,127 'result':72 'run':83 'similar':118 'singl':23 'stabl':48 'strict':61 'suit':89 'support':43 'test':19,71,81 'though':58 'unifi':24 'updat':54 'upon':117 'usag':105 'use':76 'user':68 'util':5,12 'version':49 'without':59","created_at":"2026-04-20T01:52:23.973241+00:00","updated_at":"2026-04-20T01:52:23.973241+00:00","problems":[{"fix":"Run `npm install cucumber-json-merge` in your project directory, or `npm install -g cucumber-json-merge` if using the CLI globally.","cause":"The package has not been installed or is not accessible in the current project's `node_modules`.","error":"Error: Cannot find module 'cucumber-json-merge'"},{"fix":"Install the package globally using `npm install -g cucumber-json-merge` or ensure your shell's PATH includes the global npm binary directory.","cause":"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.","error":"cucumber-json-merge: command not found"},{"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.","cause":"The input directory or specified files did not contain valid Cucumber JSON reports, or the file paths were incorrect.","error":"Merged report is empty or incomplete"},{"fix":"Use the `-o <filename>` option to specify an output file, e.g., `cucumber-json-merge report1.json report2.json -o merged-results.json`.","cause":"When using the CLI, the `--out` or `-o` option was not specified, and the command might have only printed to stdout.","error":"No output file created (when using CLI)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"cucumber-json-merge","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/bitcoder/cucumber-json-merge","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/cucumber-json-merge","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}