From 4be3c24559b430723e51858969965e163b196957 Mon Sep 17 00:00:00 2001 From: Kevin Klopfenstein Date: Thu, 30 Mar 2023 09:31:56 -0400 Subject: [PATCH] fix: set "json" output variable instead of "report" (#222) Signed-off-by: Kevin Klopfenstein --- dist/index.js | 2 +- index.js | 2 +- tests/action_args.test.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 340fa0a8..6e33f70e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -251,7 +251,7 @@ async function runScan({ source, failBuild, severityCutoff, onlyFixed, outputFor case "json": { const REPORT_FILE = "./results.json"; fs.writeFileSync(REPORT_FILE, cmdOutput); - out.report = REPORT_FILE; + out.json = REPORT_FILE; break; } default: // e.g. table diff --git a/index.js b/index.js index 62c283c0..44da0c9b 100644 --- a/index.js +++ b/index.js @@ -237,7 +237,7 @@ async function runScan({ source, failBuild, severityCutoff, onlyFixed, outputFor case "json": { const REPORT_FILE = "./results.json"; fs.writeFileSync(REPORT_FILE, cmdOutput); - out.report = REPORT_FILE; + out.json = REPORT_FILE; break; } default: // e.g. table diff --git a/tests/action_args.test.js b/tests/action_args.test.js index 84278d57..511ccbc6 100644 --- a/tests/action_args.test.js +++ b/tests/action_args.test.js @@ -5,7 +5,7 @@ const exec = require("@actions/exec"); jest.setTimeout(30000); describe("Github action args", () => { - it("runs without sarif report", async () => { + it("runs with json report", async () => { const inputs = { image: "", path: "tests/fixtures/npm-project", @@ -36,6 +36,7 @@ describe("Github action args", () => { }); expect(outputs["sarif"]).toBeFalsy(); + expect(outputs["json"]).toBe("./results.json"); spyInput.mockRestore(); spyOutput.mockRestore();