Member-only story

Cypress and getting a single report for all suites

Kristijan
3 min readOct 11, 2020

In my last post, I described how to set up mochawesome reports for Cypress tests. However, I also mentioned at the end of it a problem. It generates a separate file for every test suit. In this post, I describe how to solve that problem and have just one report containing all test results.

Cypress log

Installation

For this, you need new npm dependencies. That is mochawesome-merge package, which you can download by running the next CLI command:

npm install mochawesome-merge — save-dev

This command takes multiple JSON outputs and creates one containing all. I know you might want an HTML report, but first, we need to create JSON to generate HTML from it.

Running tests

Let’s first run tests. Because mochawesome generates a separate report for each test suite, we need to disable overwrite in report options for cypress. Also, we need to enable only JSON format because we need to merge those.

// cypress.json
{
“reporter”: “mochawesome”,
“reporterOptions”: {
“charts”: true,
“overwrite”: false,
“html”: false,
“json”: true,
“reportDir”: “cypress/report/mochawesome-report”
}
}

We can do all that with the configuration above. Also, it saves reports in…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

No responses yet

What are your thoughts?