Skip to content

Commit

Permalink
also include ignored errors in opencuts report
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoTheThird committed Jun 7, 2022
1 parent 623df82 commit 352f894
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ class Reporter {
{
name: "ubports-installer.log",
content: await logfile
}
},
...(errors.errors?.length
? [{ name: "ignored errors", content: errors.errors.join("\n\n") }]
: [])
]
}
);
Expand Down Expand Up @@ -297,7 +300,8 @@ class Reporter {
],
confirm: "Send",
extraData: {
result: "PASS"
// HACK: Set WONKY if errors had been ignored, even if PASS was specified
result: errors.errors?.length ? "WONKY" : "PASS"
}
};
}
Expand Down
57 changes: 56 additions & 1 deletion src/lib/reporter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,66 @@ describe("sendBugReport()", () => {
describe("sendOpenCutsRun()", () => {
it("should send open-cuts run", () => {
log.get.mockResolvedValue("log content");
errors.errors = ["error one", "error two"];
const smartRun = jest.fn();
OpenCutsReporter.mockImplementation(() => ({
smartRun
}));
return reporter
.sendOpenCutsRun(null, {
result: "FAIL"
})
.then(r => {
expect(r).toEqual(undefined);
expect(smartRun).toHaveBeenCalledTimes(1);
expect(smartRun).toHaveBeenCalledWith(
"5e9d746c6346e112514cfec7",
"5e9d75406346e112514cfeca",
expect.any(String),
{
combination: [
{ value: undefined, variable: "Environment" },
{ value: undefined, variable: "Package" }
],
comment: undefined,
logs: [
{ content: "log content", name: "ubports-installer.log" },
{ content: "error one\n\nerror two", name: "ignored errors" }
],
result: "FAIL"
}
);
});
});
it("should send open-cuts run", () => {
log.get.mockResolvedValue("log content");
errors.errors = [];
const smartRun = jest.fn();
OpenCutsReporter.mockImplementation(() => ({
smartRun
}));
return reporter
.sendOpenCutsRun(null, {
result: "PASS"
})
.then(r => expect(r).toEqual(undefined));
.then(r => {
expect(r).toEqual(undefined);
expect(smartRun).toHaveBeenCalledTimes(1);
expect(smartRun).toHaveBeenCalledWith(
"5e9d746c6346e112514cfec7",
"5e9d75406346e112514cfeca",
expect.any(String),
{
combination: [
{ value: undefined, variable: "Environment" },
{ value: undefined, variable: "Package" }
],
comment: undefined,
logs: [{ content: "log content", name: "ubports-installer.log" }],
result: "PASS"
}
);
});
});
});

Expand Down

0 comments on commit 352f894

Please sign in to comment.