Cypress — generating mochawesome reports

Kristijan
3 min readFeb 17, 2020

When using Cypress for testing applications, there are some reports you get out of the box. Those are video recording of test and if test fails, screenshot in the moment it fails. Quite often, that is not enough. You want some HTML output for report. That is what I will cover in this post. You will get step by step guide on how to generate report with mochawesome for e2e tests. If you are brand new to Cypress, you can read into on how to set it up in this article.

Cypress logo

Installation

Let’s start with required packages you will need to generate mochawesome reports. First package you will need is mochawesome, which you can get by executing:

npm install --save-dev mochawesome

At this moment, there are some issues with mocha that were supposed to be solved in Cypress version 4. Sadly, they haven’t, but it can be solved by installing older version of mocha by executing:

npm install --save-dev mocha@5.2.0

Setup

Once you install required dependencies, you need to do some configuration to use it. You can generate these reports by using reporter flag when running tests.

Example:

cypress run --reporter mochawesome

--

--