Closed MoonAditya closed 2 years ago
I am having a similar problem.
Env:-
cypress.json setup
"reporter": "../../../node_modules/cypress-multi-reporters", "reporterOptions": { "configFile": "reporter-config.json" },
reporter-config.json { "reporterEnabled": "cypress-mochawesome-reporter", "cypressMochawesomeReporterReporterOptions": { "reportDir": "cypress/reports", "embeddedScreenshots": true, "charts": true, "inlineAssets": true } }
When I start running the tests, it throws cypress-mochawesome-reporter is not the active reporter, ignore before run hook error. When its almost done running the tests, it throws "cypress-mochawesome-reporter is not the active reporter, ignore after run hook".
Tried both options in plugins/index file Add to cypress/plugins/index.js module.exports = (on, config) => { require('cypress-mochawesome-reporter/plugin')(on); }; or (cypress-mochawesome-reporter >= 2.2.0)
const { beforeRunHook, afterRunHook } = require('cypress-mochawesome-reporter/lib');
module.exports = (on) => { on('before:run', async (details) => { console.log('override before:run'); await beforeRunHook(details); });
on('after:run', async () => { console.log('override after:run'); await afterRunHook(); }); };
Its generating the json files but its not generating html report. Please advise!
Environment
What happened?
The issue is related to the cypress-mochawesome-reporter: { "version": "3.0.1"} this version has a strict check for the reporter name in the config.js file, see the code here
if (config.reporter === 'cypress-mochawesome-reporter') { return opts; }
It is a failing and logging a message that "cypress-mochawesome-reporter is not an active reporter" since we are providing the path of the package in our node module. I am only using this reporter. However, due to our project setup, we need the flexibility to pass the reporter value as a path along with the package name. such as,
"reporter": "../../node_modules/cypress-mochawesome-reporter",
Config file
Relevant log output
Anything else?
It should not be failing if we pass the path of the package as reporter.