mochawesome vs cucumber-html-reporter vs jest-html-reporters
HTML Test Reporting Tools for JavaScript Testing Frameworks
mochawesomecucumber-html-reporterjest-html-reportersSimilar 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
mochawesome1,513,1991,07635.7 kB825 months agoMIT
cucumber-html-reporter550,79223612.5 MB93a year agoMIT
jest-html-reporters287,9395323.18 MB222 years 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: mochawesome vs cucumber-html-reporter vs jest-html-reporters
  • 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.

  • 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.

README for mochawesome

mochawesome

npm Node.js CI Gitter

Mochawesome is a custom reporter for use with the Javascript testing framework, mocha. It runs on Node.js (>=10) and works in conjunction with mochawesome-report-generator to generate a standalone HTML/CSS report to help visualize your test runs.

Features

Mochawesome Report
  • Simple, clean, and modern design
  • Beautiful charts (via ChartJS)
  • Support for test and suite nesting
  • Displays before and after hooks
  • Review test code inline
  • Stack trace for failed tests
  • Support for adding context information to tests
  • Filters to display only the tests you want
  • Responsive and mobile-friendly
  • Offline viewing
  • Supports parallel mode

Usage

  1. Add Mochawesome to your project:

npm install --save-dev mochawesome

  1. Tell mocha to use the Mochawesome reporter:

mocha testfile.js --reporter mochawesome

  1. If using mocha programatically:
var mocha = new Mocha({
  reporter: 'mochawesome',
});

Parallel Mode

Since mocha@8 test files can be run in parallel using the --parallel flag. In order for mochawesome to work properly it needs to be registered as a hook.

mocha tests --reporter mochawesome --require mochawesome/register

Output

Mochawesome generates the following inside your project directory:

mochawesome-report/
├── assets
│   ├── app.css
│   ├── app.js
│   ├── MaterialIcons-Regular.woff
│   ├── MaterialIcons-Regular.woff2
│   ├── roboto-light-webfont.woff
│   ├── roboto-light-webfont.woff2
│   ├── roboto-medium-webfont.woff
│   ├── roboto-medium-webfont.woff2
│   ├── roboto-regular-webfont.woff
│   └── roboto-regular-webfont.woff2
├── mochawesome.html
└── mochawesome.json

The two main files to be aware of are:

mochawesome.html - The rendered report file

mochawesome.json - The raw json output used to render the report

Options

Options can be passed to the reporter in two ways.

Environment variables

The reporter will try to read environment variables that begin with MOCHAWESOME_.

$ export MOCHAWESOME_REPORTFILENAME=customReportFilename

Note that environment variables must be in uppercase.

Mocha reporter-options

You can pass comma-separated options to the reporter via mocha's --reporter-options flag. Options passed this way will take precedence over environment variables.

$ mocha test.js --reporter mochawesome --reporter-options reportDir=customReportDir,reportFilename=customReportFilename

Alternately, reporter-options can be passed in programatically:

var mocha = new Mocha({
  reporter: 'mochawesome',
  reporterOptions: {
    reportFilename: 'customReportFilename',
    quiet: true,
  },
});

Available Options

The options below are specific to the reporter. For a list of all available options see mochawesome-report-generator options.

Option NameTypeDefaultDescription
quietbooleanfalseSilence console messages
reportFilenamestringmochawesomeFilename of saved report (html and json)
See notes for available token replacements.
htmlbooleantrueSave the HTML output for the test run
jsonbooleantrueSave the JSON output for the test run
consoleReporterstringspecName of mocha reporter to use for console output, or none to disable console report output entirely

reportFilename replacement tokens

Using the following tokens it is possible to dynamically alter the filename of the generated report.

  • [name] will be replaced with the spec filename when possible.
  • [status] will be replaced with the status (pass/fail) of the test run.
  • [datetime] will be replaced with a timestamp. The format can be - specified using the timestamp option.

For example, given the spec cypress/integration/sample.spec.js and the following config:

{
  reporter: "mochawesome",
  reporterOptions: {
    reportFilename: "[status]_[datetime]-[name]-report",
    timestamp: "longDate"
  }
}

The resulting report file will be named pass_February_23_2022-sample-report.html

Note: The [name] replacement only occurs when mocha is running one spec file per process and outputting a separate report for each spec. The most common use-case is with Cypress.

Adding Test Context

Mochawesome ships with an addContext helper method that can be used to associate additional information with a test. This information will then be displayed inside the report.

Please note: arrow functions will not work with addContext. See the example.

addContext(testObj, context)

paramtypedescription
testObjobjectThe test object
contextstring|objectThe context to be added to the test

Context as a string

Simple strings will be displayed as is. If you pass a URL, the reporter will attempt to turn it into a link. If the URL links to an image or video, it will be shown inline.

Context as an object

Context passed as an object must adhere to the following shape:

{
  title: 'some title'; // must be a string
  value: {
  } // can be anything
}

Example

Be sure to use ES5 functions and not ES6 arrow functions when using addContext to ensure this references the test object.

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

describe('test suite', function () {
  it('should add context', function () {
    // context can be a simple string
    addContext(this, 'simple string');

    // context can be a url and the report will create a link
    addContext(this, 'http://www.url.com/pathname');

    // context can be an image url and the report will show it inline
    addContext(this, 'http://www.url.com/screenshot-maybe.jpg');

    // context can be an object with title and value properties
    addContext(this, {
      title: 'expected output',
      value: {
        a: 1,
        b: '2',
        c: 'd',
      },
    });
  });
});

It is also possible to use addContext from within a beforeEach or afterEach test hook.

describe('test suite', () => {
  beforeEach(function () {
    addContext(this, 'some context');
  });

  afterEach(function () {
    addContext(this, {
      title: 'afterEach context',
      value: { a: 1 },
    });
  });

  it('should display with beforeEach and afterEach context', () => {
    // assert something
  });
});

Typescript

This project does not maintain its own type definitions, however they are available on npm from DefinitelyTyped.

$ npm install --save-dev @types/mochawesome

Related

mochawesome-report-generator

License

mochawesome is MIT licensed.