Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
},
});
failedTests += totalFailed;
}
// Merge all json reports into one single json report
const jsonReport = await merge({reportDir: mochawesomeReportDir});
// Generate short summary to easily pickup via hook
const summary = generateShortSummary(jsonReport);
writeJsonToFile(summary, 'summary.json', mochawesomeReportDir);
// Generate the html report file
await generator.create(jsonReport, {reportDir: mochawesomeReportDir});
// eslint-disable-next-line
process.exit(failedTests); // exit with the number of failed tests
}
async function runTests() {
await fse.remove('mochawesome-report') // remove the report folder
const { totalFailed } = await cypress.run({
browser: "chrome",
reporter: "mochawesome",
reporterOptions: {
overwrite: false,
html: false,
json: true,
quiet: true
},
}); // get the number of failed tests
const jsonReport = await merge(); // generate JSON report
await generator.create(jsonReport);
process.exit(totalFailed); // exit with the number of failed tests
}
function done(output, config, failures, exit) {
return marge.create(output, config).then(function (_ref) {
var _ref2 = (0, _slicedToArray3.default)(_ref, 2),
htmlFile = _ref2[0],
jsonFile = _ref2[1];
log('Report JSON saved to ' + jsonFile, null, config);
log('Report HTML saved to ' + htmlFile, null, config);
}).catch(function (err) {
log(err, 'error', config);
}).then(function () {
exit && exit(failures);
});
}
function done(output, options, config, failures, exit) {
return marge.create(output, options)
.then(([ htmlFile, jsonFile ]) => {
if (!htmlFile && !jsonFile) {
log('No files were generated', 'warn', config);
} else {
jsonFile && log(`Report JSON saved to ${jsonFile}`, null, config);
htmlFile && log(`Report HTML saved to ${htmlFile}`, null, config);
}
})
.catch(err => {
log(err, 'error', config);
})
.then(() => {
exit && exit(failures > 0 ? 1 : 0);
});
}
protractorConfig.afterLaunch = async function (...args) {
const reports = await existsAsync(reportDirOptions.reportDir);
if (reports) {
const report = await merge(reportDirOptions);
await marge.create(report, { autoOpen, ...reportDirOptions });
await rimrafAsync(path.resolve(reportDirOptions.reportDir, './*.json'));
}
if (afterLaunch) {
afterLaunch.call(this, ...args);
}
};
return merge(options).then((report: any) =>
marge.create(report, options)
);