-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreporter.js
37 lines (35 loc) · 937 Bytes
/
reporter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var reporter = require("cucumber-html-reporter");
const fs = require("fs");
try {
let runInfo;
fs.readFile("run.json", (err, data) => {
if (err) {
console.log("File read failed:", err);
throw "Error opening file.";
}
runInfo = JSON.parse(data);
reporter.generate({
theme: "bootstrap",
jsonFile: "report/cucumber_report.json",
output: "report/cucumber_report.html",
reportSuiteAsScenarios: true,
launchReport: true,
metadata: {
"Breeding Insight": runInfo.BreedingInsight,
Browser: runInfo.browserName,
"Browser Version": runInfo.version,
OS: runInfo.platform,
},
});
});
} catch (err) {
console.log(err);
process.exit(1);
}
fs.readFile("report/cucumber_report.json", function (err, data) {
if (err) throw err;
if (data.includes(`"status": "failed"`)) {
console.log("Test failed.");
process.exit(1);
}
});