0

I'm running Cypress 12.13.0 with mochawesome-report-generator 6.2.0, mochawesome-merge 4.3.0 and mochawesome 7.1.3, although I've had this problem for a few versions of Cypress.

I'm using bamboo to run a powershell script to run all of the files and generate the reports. It looks like:

npx cypress run --spec 'cypress/e2e/features/**/*'

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

npx marge combined-mochawesome.json

It appears cypress is re running an entire file, which contains multiple tests, according to the report at the end. Anybody know why that is? The cypress config file doesn't have retries set.

enter image description here

The log from bamboo doesn't show an additional run, it only shows 1 run of the file. enter image description here

Samantha
  • 144
  • 6
Corey Snow
  • 225
  • 2
  • 15

2 Answers2

3

It looks like a report from a prior run is being picked up (only the last spec is repeated).

To be sure, add a "trash-assets" hook before the run

const { defineConfig } = require('cypress')
const fs = require("fs");
const path = require("path");

module.exports = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      on('before:run', (details) => {
        const resultsPath = path.resolve(__dirname, 'cypress/results')
        const files = fs.readdirSync(resultsPath)
        for (const file of files) {
          fs.unlinkSync(path.reaolve(resultsPath, file)
        }
      })
    },
  },
  experimentalInteractiveRunEvents: true,   // for open mode
})
Samantha
  • 144
  • 6
0

Turns out that a results folder with a json file checked into our repository. This was done by accident. Removing the file and folder this problem has gone away and everything works as expected now.

Corey Snow
  • 225
  • 2
  • 15