Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda