Closed
Description
I added custom reporter in cypress.json and it works fine when doing cypress run - generating failure.log.
But when I run the tests in BS, the custom reporter is not considered and no failure.log is generated.
{
"defaultCommandTimeout": 90000,
"pageLoadTimeout": 90000,
"video": false,
"retries": {
"runMode": 1,
"openMode": 0
},
"chromeWebSecurity": false,
"reporter": "./reporter.js"
}
reporter.js
const mocha = require('mocha');
const chalk = require('chalk');
module.exports = MyReporter;
function MyReporter(runner) {
mocha.reporters.Base.call(this, runner);
let passes = 0;
let failures = 0;
runner.on('pass', function(test) {
passes++;
console.log(chalk.green('Pass: ') + test.fullTitle());
});
runner.on('fail', function(test, err) {
failures++;
console.log(`${chalk.red('Fail: ') + test.fullTitle()}\n${err.message}`);
fs.appendFileSync('./failure.log', `Spec: ${test.fullTitle()} was failed\n`);
fs.appendFileSync('./failure.log', `Failure: ${err.message}\n\n`);
});
runner.on('end', function() {
console.log('End: %d/%d', passes, passes + failures);
});
}
mocha.utils.inherits(MyReporter, mocha.reporters.Spec);