cucumber-junit-formatter (v0.2.2) is a custom formatter for Cucumber.js that generates JUnit XML reports compatible with Jenkins, GitLab CI/CD, and other CI systems. It transforms Cucumber test results into the standard JUnit XML format, treating pending or undefined steps as failures. The package is maintained but receives infrequent updates, with peer dependency on cucumber >=3.0.0. Key differentiators include support for optional configuration like scenarioAsStep (wrapping scenarios as steps within features), withPackage (adding package attribute), and propertiesInTestcase (embedding properties in testcase elements). It is an alternative to cucumber-junit and cucumber-pretty, focusing on strict JUnit compliance for CI pipelines.
npm install cucumber-junit-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Install package and run Cucumber.js with JUnit formatter, demonstrating CLI usage with optional file output and format options.
Mark steps as pending or use @pending tag; alternatively, consider a different formatter if you need skipped/pending to be non-failing.
Upgrade to cucumber-js 7+ and consider using built-in JUnit formatter (@cucumber/junit-xml) or a modern alternative.
Always specify a file path after colon: -f cucumber-junit-formatter:output.xml
Ensure cucumber version is 3.x, 4.x, 5.x, or 6.x. For cucumber 7+, use @cucumber/junit-xml instead.
Set 'scenarioAsStep' according to your CI parser expectations. Many CI tools expect each testcase to be a test method (scenarioAsStep=true).
Run from project root after `npm install --save-dev cucumber-junit-formatter`. Use full path: -f `pwd`/node_modules/cucumber-junit-formatter
Do not use require. Use the CLI -f option as documented: npx cucumber-js -f cucumber-junit-formatter
If you want pending steps to be skipped, use cucumber's --no-strict option or consider a different formatter.
Use `--format-options '{"scenarioAsStep":true}'` on the command line.