cucumber-html-reporter vs jest-html-reporters vs mochawesome
HTML Test Reporting Tools for JavaScript Testing Frameworks
cucumber-html-reporterjest-html-reportersmochawesomeSimilar Packages:

HTML Test Reporting Tools for JavaScript Testing Frameworks

cucumber-html-reporter, jest-html-reporters, and mochawesome are specialized HTML reporting tools that transform test execution results into human-readable web pages. Each is tightly coupled to a specific JavaScript testing framework: cucumber-html-reporter works with Cucumber.js (Gherkin-style BDD tests), jest-html-reporters integrates directly with Jest, and mochawesome serves as a rich visual reporter for Mocha test suites. These packages parse test output — whether JSON artifacts or in-process results — and generate static HTML files that display pass/fail status, execution times, error stacks, and optional attachments like screenshots or logs, making them essential for debugging and sharing test outcomes in CI pipelines or team reviews.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
cucumber-html-reporter023712.5 MB92a year agoMIT
jest-html-reporters05373.18 MB222 years agoMIT
mochawesome01,08035.7 kB876 months agoMIT

Choosing the Right HTML Test Reporter: cucumber-html-reporter vs jest-html-reporters vs mochawesome

When running automated tests in JavaScript projects, seeing clear, actionable results is just as important as writing the tests themselves. The three packages — cucumber-html-reporter, jest-html-reporters, and mochawesome — each generate HTML reports, but they’re built for different testing ecosystems and workflows. Let’s break down how they differ in practice.

🧪 Testing Framework Compatibility: One Size Doesn’t Fit All

cucumber-html-reporter only works with Cucumber.js, which uses Gherkin syntax (.feature files with Given/When/Then). It expects JSON output generated by Cucumber’s built-in formatters.

// cucumber.js config
const report = require('cucumber-html-reporter');

const options = {
  theme: 'bootstrap',
  jsonFile: 'reports/cucumber_report.json',
  output: 'reports/cucumber_report.html',
  reportSuiteAsScenarios: true,
};

report.generate(options);

jest-html-reporters is designed exclusively for Jest. It hooks into Jest’s test results via the reporters configuration option and doesn’t require manual JSON parsing.

// jest.config.js
module.exports = {
  reporters: [
    'default',
    ['jest-html-reporters', {
      publicPath: './reports',
      filename: 'jest-report.html',
      openReport: false,
    }]
  ]
};

mochawesome integrates with Mocha (and often used alongside Chai or other assertion libraries). It acts as a Mocha reporter and can be configured via CLI or programmatically.

// mocha.opts or CLI
--reporter mochawesome
--reporter-options reportDir=reports,reportFilename=mochawesome-report

⚠️ Important: These tools are not interchangeable. You can’t use mochawesome with Jest, nor jest-html-reporters with Cucumber. Your choice is dictated by your test runner.

📊 Report Structure and Detail Level

Each tool structures information differently based on its underlying framework’s capabilities.

cucumber-html-reporter emphasizes scenarios and steps. Since Cucumber tests are behavior-driven, the report shows each Gherkin step (Given user logs in) and whether it passed or failed — ideal for collaboration with non-technical stakeholders.

# example.feature
Feature: Login
  Scenario: Valid credentials
    Given I am on the login page
    When I enter valid credentials
    Then I should see the dashboard

The resulting HTML will show this scenario with color-coded steps and screenshots (if attached via Cucumber hooks).

jest-html-reporters focuses on test suites and individual it() blocks. It displays file paths, test names, execution time, and stack traces on failure. It also supports embedding console logs and attached data (via addAttach from jest-html-reporters helpers).

// In a Jest test
import { addAttach } from 'jest-html-reporters/helper';

test('should load user profile', async () => {
  const screenshot = await page.screenshot();
  await addAttach({
    attach: screenshot.toString('base64'),
    description: 'User profile page',
    bufferFormat: 'png'
  });
});

mochawesome provides a clean, modern UI with nested suites, code snippets, and failure details. It automatically includes the actual test code next to results, which helps developers quickly locate logic without switching files.

// Mocha test
describe('API /users', () => {
  it('returns 200 for valid request', () => {
    // test body
  });
});

The report renders the full describe/it hierarchy and highlights the exact line that failed.

🖼️ Media and Attachment Support

All three support attaching extra context, but implementation varies.

cucumber-html-reporter relies on Cucumber’s attachment mechanism. You embed base64-encoded images or text in the JSON report during test execution, and the reporter renders them.

// In a Cucumber step definition
this.attach(Buffer.from(image, 'base64'), 'image/png');

jest-html-reporters provides a helper function addAttach() to inject screenshots, logs, or files into the report during test runs (as shown above).

mochawesome supports adding context via the addContext method:

const addContext = require('mochawesome/addContext');

describe('Login flow', () => {
  it('should succeed', function () {
    // ... test ...
    addContext(this, 'screenshot.png');
  });
});

Note: mochawesome requires the test function to use function (not arrow) to preserve this context.

🛠️ Configuration and Customization

cucumber-html-reporter offers themes (bootstrap, hierarchy, foundation) and basic layout options, but customization is limited to what’s exposed in its options object.

jest-html-reporters provides extensive options: custom logos, inline assets, dark mode, custom CSS, and even disabling opening the report automatically after tests.

// jest.config.js
['jest-html-reporters', {
  logoImgPath: './logo.png',
  customCSS: '.suite-name { font-weight: bold; }',
  disableLog: true
}]

mochawesome allows deep theming via reportPageTitle, inlineAssets, quiet, and more. It can also generate a single combined report from multiple test runs using mochawesome-merge.

// mocha run
mocha --reporter mochawesome --reporter-options "reportPageTitle='My Tests',inlineAssets=true"

🔄 Workflow Integration

  • Cucumber users typically run tests → generate JSON → call cucumber-html-reporter in a post-test script.
  • Jest users get reports automatically after every test run if configured in jest.config.js.
  • Mocha users get reports on every run when the reporter is enabled, or can combine results later using external tools like mochawesome-merge and mochawesome-report-generator.

🚫 Deprecation and Maintenance Status

As of the latest official sources:

  • cucumber-html-reporter is actively maintained and compatible with Cucumber v7+.
  • jest-html-reporters is under active development with regular updates for Jest compatibility.
  • mochawesome remains the de facto standard HTML reporter for Mocha and is actively maintained.

None of these packages are deprecated. However, always verify compatibility with your specific test runner version.

💡 When to Use Which?

  • If you’re using Cucumber.js for BDD, cucumber-html-reporter is your only real option — and it’s well-suited for stakeholder-friendly reports.
  • If you’re in a Jest ecosystem (common in React, Vue, or Node.js projects), jest-html-reporters integrates seamlessly and supports rich debugging context.
  • If you’re using Mocha (popular in older Node.js or Express-based test suites), mochawesome delivers polished, developer-focused reports with minimal setup.

📌 Final Thought

Don’t pick a reporter based on looks alone. Match it to your test framework first — then evaluate features like attachment support, customization, and CI/CD integration. A great report is useless if it doesn’t plug into your existing workflow.

How to Choose: cucumber-html-reporter vs jest-html-reporters vs mochawesome

  • cucumber-html-reporter:

    Choose cucumber-html-reporter if you're using Cucumber.js with Gherkin feature files and need stakeholder-friendly reports that show individual Given/When/Then steps. It’s ideal for behavior-driven development teams where non-developers review test outcomes. Avoid it if you’re not using Cucumber — it won’t work with Jest or Mocha.

  • jest-html-reporters:

    Choose jest-html-reporters if your project uses Jest and you want zero-config, automatic HTML reports with support for embedded screenshots, console logs, and custom theming. It’s perfect for React, Vue, or Node.js projects already in the Jest ecosystem. Don’t use it with other test runners — it’s Jest-exclusive.

  • mochawesome:

    Choose mochawesome if you’re running tests with Mocha and want a modern, detailed report that includes code snippets, nested test suites, and easy attachment of context like screenshots. It’s widely adopted in Mocha-based workflows, especially in API or integration testing. It won’t work with Jest or Cucumber, so ensure your test runner is Mocha.

README for cucumber-html-reporter

cucumber-html-reporter

Generate Cucumber HTML reports with pie charts

Build Status npm Code Climate License contributors

Available HTML themes: ['bootstrap', 'hierarchy', 'foundation', 'simple']

Preview of HTML Reports

Provide Cucumber JSON report file created from your framework and this module will create pretty HTML reports. Choose your best suitable HTML theme and dashboard on your CI with available HTML reporter plugins.

  1. Bootstrap Theme Reports with Pie Chart
  2. Hierarchical Feature Structure Theme Reports With Pie Chart
  3. Foundation Theme Reports
  4. Simple Theme Reports

Snapshot of Bootstrap Report

Alt text

More snapshots are availble here

Install

npm install cucumber-html-reporter --save-dev

Notes:

  • Latest version supports Cucumber 8
  • Install cucumber-html-reporter@5.5.0 for cucumber version < Cucumber@8
  • Install cucumber-html-reporter@2.0.3 for cucumber version < Cucumber@3
  • Install cucumber-html-reporter@0.5.0 for cucumber version < Cucumber@2
  • Install cucumber-html-reporter@0.4.0 for node version <0.12

Usage

Let's get you started:

  1. Install the package through npm or yarn
  2. Create an index.js and specify the options. Example of bootstrap theme:

var reporter = require('cucumber-html-reporter');

var options = {
        theme: 'bootstrap',
        jsonFile: 'test/report/cucumber_report.json',
        output: 'test/report/cucumber_report.html',
        reportSuiteAsScenarios: true,
        scenarioTimestamp: true,
        launchReport: true,
        metadata: {
            "App Version":"0.3.2",
            "Test Environment": "STAGING",
            "Browser": "Chrome  54.0.2840.98",
            "Platform": "Windows 10",
            "Parallel": "Scenarios",
            "Executed": "Remote"
        },
        failedSummaryReport: true,
    };

    reporter.generate(options);
    

    //more info on `metadata` is available in `options` section below.

    //to generate consodilated report from multi-cucumber JSON files, please use `jsonDir` option instead of `jsonFile`. More info is available in `options` section below.

Please look at the Options section below for more options

  1. Run the above code in a node.js script after Cucumber execution:
node index.js

For CucumberJS

This module converts Cucumber's JSON format to HTML reports.

The code has to be separated from CucumberJS execution (after it).

In order to generate JSON formats, run the Cucumber to create the JSON format and pass the file name to the formatter as shown below,

$ cucumberjs test/features/ -f json:test/report/cucumber_report.json

Multiple formatter are also supported,

$ cucumberjs test/features/ -f summary -f json:test/report/cucumber_report.json

Are you using cucumber with other frameworks or running cucumber-parallel? Pass relative path of JSON file to the options as shown here

Options

theme

Available: ['bootstrap', 'hierarchy', 'foundation', 'simple'] Type: String

Select the Theme for HTML report.

N.B: Hierarchy theme is best suitable if your features are organized under features-folder hierarchy. Each folder will be rendered as a HTML Tab. It supports up to 3-level of nested folder hierarchy structure.

jsonFile

Type: String

Provide path of the Cucumber JSON format file

jsonDir

Type: String

If you have more than one cucumber JSON files, provide the path of JSON directory. This module will create consolidated report of all Cucumber JSON files.

e.g. jsonDir: 'test/reports' //where reports directory contains valid *.json files

N.B.: jsonFile takes precedence over jsonDir. We recommend to use either jsonFile or jsonDir option.

output

Type: String

Provide HTML output file path and name

reportSuiteAsScenarios

Type: Boolean Supported in the Bootstrap theme.

true: Reports total number of passed/failed scenarios as HEADER.

false: Reports total number of passed/failed features as HEADER.

launchReport

Type: Boolean

Automatically launch HTML report at the end of test suite

true: Launch HTML report in the default browser

false: Do not launch HTML report at the end of test suite

ignoreBadJsonFile

Type: Boolean

Report any bad json files found during merging json files from directory option.

true: ignore any bad json files found and continue with remaining files to merge.

false: Default option. Fail report generation if any bad files found during merge.

name

Type: String (optional)

Custom project name. If not passed, module reads the name from projects package.json which is preferable.

brandTitle

Type: String (optional)

Brand Title is the brand of your report, e.g. Smoke Tests Report, Acceptance Test Report etc as per your need. If not passed, it will be displayed as "Cucumberjs Report"

columnLayout

Available: [1, 2] Type: Number Default: 2

Select the Column Layout. One column or Two columns

1 = One Column layout (col-xx-12) 2 = Two Columns Layout (col-xx-6)

storeScreenshots

Type: Boolean Default: undefined

true: Stores the screenShots to the default directory. It creates a directory 'screenshot' if does not exists.

false or undefined : Does not store screenShots but attaches screenShots as a step-inline images to HTML report

screenshotsDirectory

Type: String (optional) Default: options.output/../screenshots

Applicable if storeScreenshots=true. Relative path for directory where screenshots should be saved. E.g. the below options should store the screenshots to the <parentDirectory>/screenshots/ where as the report would be at <parentDirectory>/report/cucumber_report.html

{
   ...
   ...
   output: '/report/cucumber_report.html',
   screenshotsDirectory: 'screenshots/',
   storeScreenshots: true
}

noInlineScreenshots

Type: Boolean Default: undefined

true: Applicable if storeScreenshots=true. Avoids inlining screenshots, uses relative path to screenshots instead (i.e. enables lazy loading of images).

false or undefined: Keeps screenshots inlined.

scenarioTimestamp

Type: Boolean Default: undefined

true: Applicable if theme: 'bootstrap'. Shows the starting timestamp of each scenario within the title.

false or undefined: Does not show starting timestamp.

metadata

Type: JSON (optional) Default: undefined

Print more data to your report, such as browser info, platform, app info, environments etc. Data can be passed as JSON key-value pair. Reporter will parse the JSON and will show the Key-Value under Metadata section on HTML report. Checkout the below preview HTML Report with Metadata.

Pass the Key-Value pair as per your need, as shown in below example,


 metadata: {
        "App Version":"0.3.2",
        "Test Environment": "STAGING",
        "Browser": "Chrome  54.0.2840.98",
        "Platform": "Windows 10",
        "Parallel": "Scenarios",
        "Executed": "Remote"
      }

failedSummaryReport

Type: Boolean

A summary report of all failed scenarios will be listed in a grid, which its scenario title, tags, failed step and exception.

true: Insert failed summary report.

false: Failed summary report will not be inserted.

Tips

Attach Screenshots to HTML report

Capture and Attach screenshots to the Cucumber Scenario and HTML report will render the screenshot image

for Cucumber V8


  let world = this;

  return driver.takeScreenshot().then((screenShot) => {
      // screenShot is a base-64 encoded PNG
      world.attach(screenShot, 'image/png');
  });

for Cucumber V2 and V3


  var world = this;

  driver.takeScreenshot().then(function (buffer) {
    return world.attach(buffer, 'image/png');
  };

for Cucumber V1


  driver.takeScreenshot().then(function (buffer) {
    return scenario.attach(new Buffer(buffer, 'base64'), 'image/png');
  };

Attach Plain Text to HTML report

Attach plain-texts/data to HTML report to help debug/review the results


  scenario.attach('test data goes here');

Attach pretty JSON to HTML report

Attach JSON to HTML report


  scenario.attach(JSON.stringify(myJsonObject, undefined, 4));

Changelog

changelog