---
id: app/tooling/reporters
title: 'Built-in and custom reporters in Cypress: setup guide'
description: >-
  Learn how to use custom reporters in Cypress to output test results in
  different formats.
section: app
source_path: docs/app/tooling/reporters.mdx
version: 3163d68b20e695f2c76d40c85c3f3b956dd19a3b
updated_at: '2026-08-21T20:59:04.402Z'
---
# Reporters in Cypress

What you'll learn

*   How to use custom reporters in Cypress
*   How to use multiple reporters
*   How to merge reports across spec files

## Introduction

After writing and running tests in Cypress, reviewing the results of those tests is crucial. Cypress provides several options to review results of a test run.

*   [Cypress Cloud](/llm/markdown/cloud/get-started/introduction.md) - See test results, spec data, errors, screenshots, videos, and Test Replay in Cypress Cloud.
*   Cypress App's open source built in and custom reporters.

This document covers how to use [built in](#Built-in-reporters) and [custom](#Custom-reporters) reporters in Cypress App.

To get started with Cypress Cloud, [sign up](https://cloud.cypress.io/signup) to start your **30 day free trial** - including all premium Cypress Cloud features and plenty of test results to let you experience the power of Cypress Cloud!

## Built in reporters

Because Cypress is built on top of Mocha, that means any reporter built for Mocha can be used with Cypress. Here is a list of built in Mocha reporters.

*   [Mocha's built-in reporters](https://mochajs.org/#reporters)

By default, Cypress uses the `spec` reporter to output information to `STDOUT`.

We've also added the two most common 3rd party reporters for Mocha. These are built into Cypress and you can use them without installing anything.

*   [`teamcity`](https://github.com/travisjeffery/mocha-teamcity-reporter)
*   [`junit`](https://github.com/michaelleeallen/mocha-junit-reporter)

## Custom reporters

Cypress supports creating your own custom reporters or using any kind of 3rd party reporter.

### Installed locally

You can load [custom Mocha reporters](https://mochajs.org/api/tutorial-custom-reporter.html) through a relative or absolute path. These can be specified in your Cypress configuration file or via the [command line](/llm/markdown/app/references/command-line.md).

For example, if you have the following directory structure:

```
> my-project
  > cypress
  > src
  > reporters
    - custom.js
```

You would specify the path to your custom reporter in either of the ways below.

#### Cypress configuration

*   cypress.config.js
*   cypress.config.ts

```
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  reporter: 'reporters/custom.js',
})
```

```
import { defineConfig } from 'cypress'

export default defineConfig({
  reporter: 'reporters/custom.js',
})
```

#### Command Line

*   npm
*   Yarn
*   pnpm
*   Bun

```
npx cypress run --reporter reporters/custom.js
```

```
yarn cypress run --reporter reporters/custom.js
```

```
pnpm cypress run --reporter reporters/custom.js
```

```
bunx cypress run --reporter reporters/custom.js
```

### Installed via npm

When using custom reporters via npm, specify the package name.

#### Cypress configuration

*   cypress.config.js
*   cypress.config.ts

```
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  reporter: 'mochawesome',
})
```

```
import { defineConfig } from 'cypress'

export default defineConfig({
  reporter: 'mochawesome',
})
```

#### Command line

*   npm
*   Yarn
*   pnpm
*   Bun

```
npx cypress run --reporter mochawesome
```

```
yarn cypress run --reporter mochawesome
```

```
pnpm cypress run --reporter mochawesome
```

```
bunx cypress run --reporter mochawesome
```

## Reporter Options

Some reporters accept options that customize their behavior. These can be specified in your Cypress configuration or via [command line](/llm/markdown/app/references/command-line.md) options.

Reporter options differ depending on the reporter (and may not be supported at all). Refer to the documentation for the reporter you are using for details on which options are supported.

The below configuration will output the JUnit report to `STDOUT` and save it into an XML file.

### Cypress configuration

*   cypress.config.js
*   cypress.config.ts

```
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  reporter: 'junit',
  reporterOptions: {
    mochaFile: 'results/my-test-output.xml',
    toConsole: true,
  },
})
```

```
import { defineConfig } from 'cypress'

export default defineConfig({
  reporter: 'junit',
  reporterOptions: {
    mochaFile: 'results/my-test-output.xml',
    toConsole: true,
  },
})
```

### Command line

*   npm
*   Yarn
*   pnpm
*   Bun

```
npx cypress run --reporter junit --reporter-options "mochaFile=results/my-test-output.xml,toConsole=true"
```

```
yarn cypress run --reporter junit --reporter-options "mochaFile=results/my-test-output.xml,toConsole=true"
```

```
pnpm cypress run --reporter junit --reporter-options "mochaFile=results/my-test-output.xml,toConsole=true"
```

```
bunx cypress run --reporter junit --reporter-options "mochaFile=results/my-test-output.xml,toConsole=true"
```

When running multiple spec files, a static `mochaFile` name like `results/my-test-output.xml` is **overwritten by each spec**, so the final report only contains the results from the last spec that ran. Use the `[hash]` token to write one file per spec, then merge them. See [Merging reports across spec files](#Merging-reports-across-spec-files) below.

## Merging reports across spec files

Each spec file is processed completely separately during each `cypress run` execution. Thus each spec run _overwrites_ the previous report file. To preserve unique reports for each specfile, use the `[hash]` in the `mochaFile` filename.

The following configuration will create separate XML files in the `results` folder. You can then merge the reported output in a separate step using a 3rd party tool. For JUnit XML reports, you can use [junit-report-merger](https://www.npmjs.com/package/junit-report-merger), and for the [Mochawesome](https://github.com/adamgruber/mochawesome) reporter, you can use the [mochawesome-merge](https://github.com/antontelesh/mochawesome-merge) tool.

### Cypress configuration

*   cypress.config.js
*   cypress.config.ts

```
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  reporter: 'junit',
  reporterOptions: {
    mochaFile: 'results/my-test-output-[hash].xml',
  },
})
```

```
import { defineConfig } from 'cypress'

export default defineConfig({
  reporter: 'junit',
  reporterOptions: {
    mochaFile: 'results/my-test-output-[hash].xml',
  },
})
```

### Command line

*   npm
*   Yarn
*   pnpm
*   Bun

```
npx cypress run --reporter junit --reporter-options "mochaFile=results/my-test-output-[hash].xml"
```

```
yarn cypress run --reporter junit --reporter-options "mochaFile=results/my-test-output-[hash].xml"
```

```
pnpm cypress run --reporter junit --reporter-options "mochaFile=results/my-test-output-[hash].xml"
```

```
bunx cypress run --reporter junit --reporter-options "mochaFile=results/my-test-output-[hash].xml"
```

## Multiple reporters

Oftentimes we see users wanting the ability to use multiple reporters. When running in CI, you might want to generate a report for `junit` and perhaps a `json` report. This is great, but by setting this reporter you won't receive any additional feedback while the tests are running!

The solution here is to use multiple reporters. You will have the benefit of both worlds.

We suggest using the npm module [cypress-multi-reporters](https://www.npmjs.com/package/cypress-multi-reporters).

### Examples

#### Spec to `STDOUT`, save JUnit XML files

We want to output a `spec` report to `STDOUT`, while saving a JUnit XML file for each spec file.

We need to install additional dependencies:

*   [`cypress-multi-reporters`](https://github.com/YOU54F/cypress-plugins/tree/master/cypress-multi-reporters): enables multiple reporters
*   [`mocha-junit-reporter`](https://github.com/michaelleeallen/mocha-junit-reporter) the actual junit reporter, as we cannot use the `junit` reporter that comes with Cypress

*   npm
*   Yarn
*   pnpm
*   Bun

```
npm install cypress-multi-reporters mocha-junit-reporter --save-dev
```

```
yarn add cypress-multi-reporters mocha-junit-reporter --dev
```

```
pnpm add --save-dev cypress-multi-reporters mocha-junit-reporter
```

```
bun add --dev cypress-multi-reporters mocha-junit-reporter
```

Specify your reporter and reporterOptions in your Cypress configuration or via the [command line](/llm/markdown/app/references/command-line.md).

#### Cypress configuration

*   cypress.config.js
*   cypress.config.ts

```
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  reporter: 'cypress-multi-reporters',
  reporterOptions: {
    configFile: 'reporter-config.json',
  },
})
```

```
import { defineConfig } from 'cypress'

export default defineConfig({
  reporter: 'cypress-multi-reporters',
  reporterOptions: {
    configFile: 'reporter-config.json',
  },
})
```

#### Command line

*   npm
*   Yarn
*   pnpm
*   Bun

```
npx cypress run --reporter cypress-multi-reporters --reporter-options configFile=reporter-config.json
```

```
yarn cypress run --reporter cypress-multi-reporters --reporter-options configFile=reporter-config.json
```

```
pnpm cypress run --reporter cypress-multi-reporters --reporter-options configFile=reporter-config.json
```

```
bunx cypress run --reporter cypress-multi-reporters --reporter-options configFile=reporter-config.json
```

Then add the separate `reporter-config.json` file (defined in your configuration) to enable `spec` and `junit` reporters and direct the `junit` reporter to save separate XML files.

reporter-config.json

```
{
  "reporterEnabled": "spec, mocha-junit-reporter",
  "mochaJunitReporterReporterOptions": {
    "mochaFile": "cypress/results/results-[hash].xml"
  }
}
```

We recommend deleting all files from the `cypress/results` folder before running this command, since each run will output new XML files. For example, you can add the npm script commands below to your `package.json` then call `npm run report`.

package.json

```
{
  "scripts": {
    "delete:reports": "rm cypress/results/* || true",
    "prereport": "npm run delete:reports",
    "report": "cypress run --reporter cypress-multi-reporters --reporter-options configFile=reporter-config.json"
  }
}
```

In case you want to combine generated XML files into a single one, [junit-report-merger](https://www.npmjs.com/package/junit-report-merger) can be added. For example, to combine all files into `cypress/results/combined-report.xml` the `combine:reports` script can be added.

package.json

```
{
  "scripts": {
    "delete:reports": "rm cypress/results/* || true",
    "combine:reports": "jrm cypress/results/combined-report.xml \"cypress/results/*.xml\"",
    "prereport": "npm run delete:reports",
    "report": "cypress run --reporter cypress-multi-reporters --reporter-options configFile=reporter-config.json",
    "postreport": "npm run combine:reports"
  }
}
```

#### Spec to `STDOUT`, produce a combined Mochawesome JSON file

This example is shown in the branch `spec-and-single-mochawesome-json` in [https://github.com/cypress-io/cypress-example-circleci-orb](https://github.com/cypress-io/cypress-example-circleci-orb). We want to output a "spec" report to `STDOUT`, save an individual Mochawesome JSON file per test file, and then combine all JSON reports into a single report.

We need to install some additional dependencies.

*   npm
*   Yarn
*   pnpm
*   Bun

```
npm install mochawesome mochawesome-merge mochawesome-report-generator --save-dev
```

```
yarn add mochawesome mochawesome-merge mochawesome-report-generator --dev
```

```
pnpm add --save-dev mochawesome mochawesome-merge mochawesome-report-generator
```

```
bun add --dev mochawesome mochawesome-merge mochawesome-report-generator
```

We need to configure the reporter in your [Cypress configuration](/llm/markdown/app/references/configuration.md) to skip the HTML report generation and save each individual JSON file in the `cypress/results` folder.

#### Cypress configuration

*   cypress.config.js
*   cypress.config.ts

```
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  reporter: 'mochawesome',
  reporterOptions: {
    reportDir: 'cypress/results',
    overwrite: false,
    html: false,
    json: true,
  },
})
```

```
import { defineConfig } from 'cypress'

export default defineConfig({
  reporter: 'mochawesome',
  reporterOptions: {
    reportDir: 'cypress/results',
    overwrite: false,
    html: false,
    json: true,
  },
})
```

#### Command line

*   npm
*   Yarn
*   pnpm
*   Bun

```
npx cypress run --reporter mochawesome --reporter-options reportDir="cypress/results",overwrite=false,html=false,json=true
```

```
yarn cypress run --reporter mochawesome --reporter-options reportDir="cypress/results",overwrite=false,html=false,json=true
```

```
pnpm cypress run --reporter mochawesome --reporter-options reportDir="cypress/results",overwrite=false,html=false,json=true
```

```
bunx cypress run --reporter mochawesome --reporter-options reportDir="cypress/results",overwrite=false,html=false,json=true
```

Our run will generate files `cypress/results/mochawesome.json, cypress/results/mochawesome_001.json, ...`. Then we can combine them using the [mochawesome-merge](https://github.com/antontelesh/mochawesome-merge) utility.

*   npm
*   Yarn
*   pnpm
*   Bun

```
npx mochawesome-merge cypress/results/*.json -o mochawesome.json
```

```
yarn mochawesome-merge cypress/results/*.json -o mochawesome.json
```

```
pnpm mochawesome-merge cypress/results/*.json -o mochawesome.json
```

```
bunx mochawesome-merge cypress/results/*.json -o mochawesome.json
```

We can now generate a combined HTML report from the `mochawesome.json` file using the [https://github.com/adamgruber/mochawesome-report-generator](https://github.com/adamgruber/mochawesome-report-generator):

*   npm
*   Yarn
*   pnpm
*   Bun

```
npx marge mochawesome.json
```

```
yarn marge mochawesome.json
```

```
pnpm marge mochawesome.json
```

```
bunx marge mochawesome.json
```

It generates the beautiful standalone HTML report file `mochawesome-report/mochawesome.html` shown below. As you can see all test results, timing information, and even test bodies are included.

For more information, see [Integrating Mochawesome reporter with Cypress's](http://antontelesh.github.io/testing/2019/02/04/mochawesome-merge.html)

## History

| Version | Changes |
| --- | --- |
| [4.4.2](/llm/markdown/app/references/changelog.md) | Custom Mocha reporters updated to use the version of Mocha bundled with Cypress. No need to install `mocha` separately to use custom reporters. |
