diff --git a/src/lib/reporter.js b/src/lib/reporter.js index 5661e31f..3aba3d20 100644 --- a/src/lib/reporter.js +++ b/src/lib/reporter.js @@ -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") }] + : []) ] } ); @@ -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" } }; } diff --git a/src/lib/reporter.spec.js b/src/lib/reporter.spec.js index 7f25f6dc..7b36801f 100644 --- a/src/lib/reporter.spec.js +++ b/src/lib/reporter.spec.js @@ -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" + } + ); + }); }); });