Neel Chavan
Neel Chavan

Reputation: 177

cypress-mochawesome-reporter is not generating html reports

my mochawesome reporter is not generating html reports when I created a separate function for 'setupNodeEvents' before creating this function it was working fine, in image shared below you can see it is generating some json files but not generating html document of report, and i am using a package called "cypress-mochawesome-reporter": "^3.3.0"

cypress.config.js -

const { defineConfig } = require("cypress");
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const browserify = require("@badeball/cypress-cucumber-preprocessor/browserify");

async function setupNodeEvents(on, config) {
  screenshotOnRunFailure = true;
  require("cypress-mochawesome-reporter/plugin")(on); // for html reports

  // This is required for the preprocessor to be able to generate JSON reports after each run, and more,
  await preprocessor.addCucumberPreprocessorPlugin(on, config);
  on("file:preprocessor", browserify.default(config));

  // Make sure to return the config object as it might have been modified by the plugin.
  return config;
}

module.exports = defineConfig({
  reporter: "cypress-mochawesome-reporter", // for html reports
  env: {
    baseUrl: "https://rahulshettyacademy.com/angularpractice/",
  },
  e2e: {
    setupNodeEvents,
    specPattern: "cypress/integration/Tests/*.js",
    // specPattern: "cypress/integration/Tests/BDD/*.feature",
    downloadsFolder: "cypress/downloads",
  },
});

enter image description here

Upvotes: 1

Views: 1666

Answers (1)

MonicaG
MonicaG

Reputation: 1

I had the same problem and could resolve install mochawesome too and configure the cypress.config.js.

reporter:"mochawesome",
    reporterOptions:{
      "reportDir":"reports",
      charts: true,
      reportPageTitle: 'MoniGuerra with Mochawesome Reporter',
      embeddedScreenshots: true,
      inlineAssets: true,
      saveAllAttempts: false,
    }

mochawesome report

Please read this article for more information: https://www.lambdatest.com/blog/how-to-generate-mocha-reports-with-mochawesome/

Upvotes: -2

Related Questions