Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

108
Vistas
Unable to merge mochaweasome reports

I have the below config in my test runner and trying to merge all the mochaweasome.html file as single mocha file.

Runner.js

async function testRunner(fixture) {
  return cypress.run({
    config: {
      "reporter": "mochawesome",
      "reporterOptions": {
        "reportFilename": "sample" + `${fixture}`,
        "reportDir":"./cypress/reports/",
        "charts": true,
        "overwrite": false,
        "html": true,
        "json": true
      }
    },
    env: {
      testcaseID: `${fixture}`,
    },
    spec: './cypress/integration/' + `${param.getSpec()}` + ".spec.js",

  });
}

TestRunner.js:

const testRunner = require("./Runner.js");

const options = {
    files: [
      './cypress/reports/*.html',
    ],
  }

async function generateReport(options) {
    return merge(options).then(report => marge.create(report, options))
}

async function runner(dataSet) {
 for (let i = 0; i < dataSet.length; i += 1) {
            await setTimeout[Object.getOwnPropertySymbols(setTimeout)[0]](10000);
                try {
                    await testRunner(dataSet[i]).then((result) => {
                        console.log(JSON.stringify(result, null, " "));
                        generateReport(options);
                        if (result.runs[0].stats.failures === 1) {
                            retry.push(result.config.env.testcaseID);
                        }
                    },
                        error => {
                            generateReport(options);
                            console.error(error);
                            process.exit(1);
                        });
                }
                catch (err) {
                    process.exit(1);
                }
        }
}

Test Report is created like below:

enter image description here

But It's not merged as single report as per the code.

Can someone help me to fix this. I just want single mochaweasome_final report which contains all the result in a single .html file.

Updated:

Used cypress-mochawesome-reporter and followed all the steps. But still the report is not merged. How can I merge all the 5 html files into single one.

Output:

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

First, you have to install mocha reporter using npm i cypress-mochawesome-reporter command.

and then you have to put this import in support/index.js

import 'cypress-mochawesome-reporter/register';

And import this line in plugin/index.js

module.exports = (on, config) => {
  require('cypress-mochawesome-reporter/plugin')(on);
};

And then in your cypress.json file

"reporter": "cypress-mochawesome-reporter",
  "reporterOptions": {
    "reportDir": "cypress/reports",
    "charts": true,
    "overwrite": false,
    "html": false,
    "json": true,
    "reportPageTitle": "My Test Suite",
    "embeddedScreenshots": true,
    "inlineAssets": true

Reference: https://www.npmjs.com/package/cypress-mochawesome-reporter

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda