DEV Community

Joan Esquivel
Joan Esquivel

Posted on

Cypress 10+ & Mochawesome Reporter

There are different report solutions for Cypress E2E tests using Javascript or Typescript. However, there is a library that print the results in an styled HTML with emmbeded screenshots, that provides a lot of insights when you need to check the test results.

The choosen one is cypress-mochawesome-reporter and let's explore the installation steps:

  1. Install Node JS in your computer depending your operating system.

  2. Have a Cypress project already setup with Javascript or Typescript. Check how to install Cypress 10+

3- Install the library using the command: npm i --save-dev cypress-mochawesome-reporter

4- Edit the configuration file 'cypress.config.js' or 'cypress.config.ts' with the properties:

  • reporter: 'cypress-mochawesome-reporter'
  • e2e: { setupNodeEvents(on, config) { require('cypress-mochawesome-reporter/plugin')(on); },

5- Add the following line to the "cypress/support/e2e.js/ts" configuration file: import 'cypress-mochawesome-reporter/register';

*If you need a visual example just check the following video: *

See you soon!

Top comments (0)