DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

How to Generate Mocha Test Reports With Mochawesome

Generate an HTML and JSON Mocha test report with Mochawesome, customize its output, and handle Mocha parallel mode.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install mochawesome as a development dependency, then run Mocha with --reporter mochawesome. By default, the reporter creates a readable HTML report and raw JSON data in mochawesome-report/.

Install Mochawesome and generate your first report

  1. From your project directory, install Mochawesome:

    npm install --save-dev mochawesome
  2. Run Mocha with the reporter selected:

    npx mocha testfile.js --reporter mochawesome

    Replace testfile.js with your test file or the path/glob your project uses. If your project runs tests through an npm script, add the reporter and its options to that script instead. The package documentation also shows calling mocha directly; use whichever executable resolution your project already uses.

    As an Amazon Associate I earn from qualifying purchases.

  3. Open mochawesome-report/mochawesome.html in a browser to read the report. The companion mochawesome.json contains the raw report data.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Mochawesome is a custom reporter for Mocha. The package documentation accessed on October 3, 2026 lists Node.js 18 or later and Mocha 8–12 as requirements. These version ranges can change, so check the current Mochawesome package page if installation or compatibility fails.

Choose output formats and report names

Mochawesome’s documented defaults enable both HTML and JSON output. The HTML is intended for reading; JSON is structured data suitable for another reporting step or tool.

Option Documented default What it controls
reportFilename mochawesome Base filename for report output.
html true Whether to produce HTML.
json true Whether to produce JSON.
quiet false Whether to quiet the reporter’s output.
consoleReporter spec Console reporter to use; set to none to suppress console report output.

Pass reporter options as comma-separated values after --reporter-options. For example, this changes the report directory and base filename:

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

Options can also be provided as a reporterOptions object in programmatic use. The package documentation supports environment variables prefixed with MOCHAWESOME_; options passed directly to the reporter take precedence over environment variables.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Mochawesome with Mocha parallel mode

Parallel mode needs an additional registration step. Use the documented mochawesome/register hook:

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

Mocha creates a separate instance for each test file in parallel mode. Its guidance recommends putting root hooks that must apply across files in a required file. Do not rely on a fixed order of file execution in parallel runs; workers can execute files independently.

Generate HTML later from JSON with marge

If you want to keep test execution separate from report rendering, the mochawesome-report-generator package, commonly called marge, accepts Mochawesome JSON and produces HTML/CSS output. Its documented controls include the report filename and directory, title, asset handling, chart display, and whether to save HTML or JSON. This is useful when JSON is already available or you want a separate generation step. See the report-generator package documentation for its current options.

Mochawesome versus Mocha’s built-in JSON reporter

These reporters serve different output needs. Mochawesome generates an HTML report alongside JSON by default; Mocha’s built-in JSON reporter outputs a JSON object after tests finish and can write it to a specified filename. The built-in JSON reporter alone does not create the Mochawesome HTML report. See Mocha’s reporter documentation.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common report problems

  • No report appears: Confirm the command selected --reporter mochawesome, ran from the intended project, and completed with a test file or matching test path. Check the configured reportDir rather than assuming the default output location.

  • Mocha cannot find the reporter: Install mochawesome in the project with npm install --save-dev mochawesome and invoke Mocha through the project’s local executable, such as npx mocha. Check Node.js and Mocha against the compatibility requirements on the current package page.

  • HTML or JSON is missing: Check whether the corresponding html or json option was disabled. Both are enabled by default according to the package documentation.

  • The output has an unexpected name or location: Review reportFilename, reportDir, environment variables beginning with MOCHAWESOME_, and any command-line reporter options. Directly passed reporter options take precedence over environment variables.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Parallel execution behaves differently: Include --require mochawesome/register and avoid assumptions about file order or shared per-file Mocha instances. Put cross-file root hooks in a required file as Mocha recommends.

Or skip the browser setup

If your next step is capturing a web page for visual review, ScreenshotNeo is a website screenshot API and MCP server for developers. Its API returns a screenshot or PDF from one GET request. For example, use cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for setup and options. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card required.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.