mochawesome-report-generator vs mochawesome vs cucumber-html-reporter vs jest-html-reporters
JavaScript Test Reporting Libraries Comparison
1 Year
mochawesome-report-generatormochawesomecucumber-html-reporterjest-html-reportersSimilar Packages:
What's JavaScript Test Reporting Libraries?

JavaScript test reporting libraries are tools that generate visual reports from test results, making it easier for developers to understand the outcomes of their testing processes. These libraries enhance the visibility of test results by providing structured, user-friendly reports that can be shared with team members or stakeholders. They cater to different testing frameworks and methodologies, allowing for a variety of reporting styles and formats. By utilizing these libraries, teams can improve their testing workflows and maintain high-quality code through better insights into test performance.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
mochawesome-report-generator1,444,7732371.15 MB80-MIT
mochawesome1,377,8491,06835.7 kB81-MIT
cucumber-html-reporter355,85923312.5 MB905 months agoMIT
jest-html-reporters214,7575263.18 MB19a year agoMIT
Feature Comparison: mochawesome-report-generator vs mochawesome vs cucumber-html-reporter vs jest-html-reporters

Integration

  • mochawesome-report-generator:

    Mochawesome Report Generator takes the JSON output from Mochawesome and transforms it into a customizable HTML report, allowing for greater flexibility in how reports are generated and displayed.

  • mochawesome:

    Mochawesome works seamlessly with Mocha, providing a straightforward setup for generating detailed reports from Mocha test runs. It captures all relevant test information and presents it in a visually appealing format.

  • cucumber-html-reporter:

    Cucumber HTML Reporter integrates directly with Cucumber, allowing for easy generation of reports from BDD-style tests. It captures the results of scenarios written in Gherkin syntax, making it ideal for teams practicing BDD.

  • jest-html-reporters:

    Jest HTML Reporters is designed specifically for Jest, ensuring a smooth integration that leverages Jest's built-in features for reporting, making it easy to set up and use without additional configuration.

Output Format

  • mochawesome-report-generator:

    Generates HTML reports from Mochawesome's JSON output, allowing for customization in the report's appearance and structure, catering to specific project needs.

  • mochawesome:

    Creates comprehensive reports in both HTML and JSON formats, providing detailed insights into test execution, including pass/fail counts, duration, and error messages.

  • cucumber-html-reporter:

    Generates visually rich HTML reports that are easy to read and understand, suitable for both technical and non-technical audiences, with a focus on the BDD approach.

  • jest-html-reporters:

    Produces clean and simple HTML reports that highlight test results and coverage, making it easier for developers to quickly assess the status of their tests.

Customization

  • mochawesome-report-generator:

    Provides extensive customization options for the generated reports, including themes and layout adjustments, giving teams control over how their test results are presented.

  • mochawesome:

    Highly customizable, allowing users to modify the report's layout, themes, and included information, making it adaptable to various team preferences.

  • cucumber-html-reporter:

    Offers limited customization options focused on maintaining the integrity of BDD reports, ensuring that the output remains consistent with the Gherkin syntax.

  • jest-html-reporters:

    Allows for some level of customization in the report's appearance, enabling teams to tailor the output to fit their branding or specific reporting needs.

Ease of Use

  • mochawesome-report-generator:

    Requires familiarity with Mochawesome's JSON output but is user-friendly in generating reports, making it a good choice for teams already using Mochawesome.

  • mochawesome:

    While it requires Mocha as a prerequisite, it is straightforward to use and generates detailed reports with little overhead, making it accessible for teams familiar with Mocha.

  • cucumber-html-reporter:

    Designed for simplicity in generating reports from Cucumber tests, making it easy for teams to implement without extensive setup or configuration.

  • jest-html-reporters:

    Very easy to set up and use with Jest, requiring minimal configuration to start generating reports, making it suitable for teams looking for quick integration.

Community Support

  • mochawesome-report-generator:

    Supported by the Mochawesome community, providing ample resources and support for users looking to customize their reporting experience.

  • mochawesome:

    Has a strong community backing, with frequent updates and a variety of plugins and extensions available to enhance its functionality.

  • cucumber-html-reporter:

    Supported by a community focused on BDD practices, ensuring ongoing updates and improvements aligned with Cucumber's evolution.

  • jest-html-reporters:

    Benefits from Jest's large community, ensuring regular updates and a wealth of resources for troubleshooting and enhancements.

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

    Use Mochawesome Report Generator if you want to generate reports from existing Mochawesome JSON output, providing flexibility in how you present your test results and the ability to customize the report format.

  • mochawesome:

    Select Mochawesome if you are using Mocha as your testing framework and need a comprehensive report that combines both HTML and JSON formats, allowing for detailed insights into test execution and easy integration with CI/CD pipelines.

  • cucumber-html-reporter:

    Choose Cucumber HTML Reporter if you are using Cucumber for behavior-driven development (BDD) and need a visually appealing report that reflects the Gherkin syntax of your tests, making it easier for non-technical stakeholders to understand the test outcomes.

  • jest-html-reporters:

    Opt for Jest HTML Reporters if you are using Jest as your testing framework and want a simple, customizable HTML report that integrates seamlessly with Jest's output, providing a clear overview of test results and coverage.

README for mochawesome-report-generator

mochawesome-report-generator (marge)

npm Node CI

marge (mochawesome-report-generator) is the counterpart to mochawesome, a custom reporter for use with the Javascript testing framework, mocha. Marge takes the JSON output from mochawesome and generates a full fledged HTML/CSS report that helps visualize your test suites.

Features

Mochawesome Report
  • Simple, clean, and modern design
  • 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
  • CLI for generating reports independent of mochawesome

Usage with mochawesome

  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'
});

CLI Usage

Install mochawesome-report-generator package

npm install -g mochawesome-report-generator

Run the command

marge [options] data_file [data_file2 ...]

Output

marge 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

Options

CLI Flags

marge can be configured via the following command line flags:

Flag | Type | Default | Description :--- | :--- | :------ | :---------- -f, --reportFilename | string | mochawesome | Filename of saved report. See notes for available token replacements. -o, --reportDir | string | [cwd]/mochawesome-report | Path to save report -t, --reportTitle | string | mochawesome | Report title -p, --reportPageTitle | string | mochawesome-report | Browser title -i, --inline | boolean | false | Inline report assets (scripts, styles) --cdn | boolean | false | Load report assets via CDN (unpkg.com) --assetsDir | string | [cwd]/mochawesome-report/assets | Path to save report assets (js/css) --charts | boolean | false | Display Suite charts --code | boolean | true | Display test code --autoOpen | boolean | false | Automatically open the report --overwrite | boolean | true | Overwrite existing report files. See notes. --timestamp, --ts | string | | Append timestamp in specified format to report filename. See notes. --showPassed | boolean | true | Set initial state of "Show Passed" filter --showFailed | boolean | true | Set initial state of "Show Failed" filter --showPending | boolean | true | Set initial state of "Show Pending" filter --showSkipped | boolean | false | Set initial state of "Show Skipped" filter --showHooks | string | failed | Set the default display mode for hooks
failed: show only failed hooks
always: show all hooks
never: hide all hooks
context: show only hooks that have context --saveJson | boolean | false |Should report data be saved to JSON file --saveHtml | boolean | true | Should report be saved to HTML file --dev | boolean | false | Enable dev mode (requires local webpack dev server) -h, --help | | | Show CLI help

Boolean options can be negated by adding --no before the option. For example: --no-code would set code to false.

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.

overwrite

By default, report files are overwritten by subsequent report generation. Passing --overwrite=false will not replace existing files. Instead, if a duplicate filename is found, the report will be saved with a counter digit added to the filename. (ie. mochawesome_001.html).

Note: overwrite will always be false when passing multiple files or using the timestamp option.

timestamp

The timestamp option can be used to append a timestamp to the report filename. It uses dateformat to parse format strings so you can pass any valid string that dateformat accepts with a few exceptions. In order to produce valid filenames, the following replacements are made:

Characters | Replacement | Example | Output :--- | :--- | :--- | :--- spaces, commas | underscore | Wed March 29, 2017 | Wed_March_29_2017 slashes | hyphen | 3/29/2017 | 3-29-2017 colons | null | 17:46:21 | 174621

If you pass true as the format string, it will default to isoDateTime.

mochawesome reporter-options

The above CLI flags can be used as reporter-options when using the mochawesome reporter.

Use them in a .mocharc.js file:

module.exports = {
    reporter: 'node_modules/mochawesome',
    'reporter-option': [
        'overwrite=true',
        'reportTitle=My\ Custom\ Title',
        'showPassed=false'
    ],
};

or as an object when using mocha programmatically:

const mocha = new Mocha({
  reporter: 'mochawesome',
  reporterOptions: {
    overwrite: true,
    reportTitle: 'My Custom Title',
    showPassed: false
  }
});

Development

To develop locally, clone the repo and install dependencies. In order to test end-to-end you must also clone mochawesome into a directory at the same level as this repo.

You can start the dev server with npm run devserver. If you are working on the CLI, use npm run dev:cli to watch for changes and rebuild.

Running Tests

Unit Tests

To run unit tests, simply use npm run test. You can also run a single unit test with npm run test:single path/to/test.js.

Functional Tests

Functional tests allow you to run real-world test cases in order to debug the output report. First, start up the dev server in one terminal window with npm run devserver. Then, in another window, run the tests with npm run test:functional. This will generate a report that you can open in the browser and debug.

If you want to run a specific folder of functional tests: npm run test:functional path/to/tests

Or if you want to run a single test: npm run test:functional path/to/test.js

Or mix and match: npm run test:functional path/to/some/tests path/to/another/test.js