diff --git a/__tests__/config.test.ts b/__tests__/config.test.ts index 5694cf7..13be949 100644 --- a/__tests__/config.test.ts +++ b/__tests__/config.test.ts @@ -57,6 +57,27 @@ describe("getInputs", () => { script: "script.js", }); }); + + it("returns empty args list when none are given", () => { + (getInput as jest.Mock).mockImplementation((name, _) => { + switch (name) { + case "version": + return ""; + case "args": + return ""; + case "script": + return "script.js"; + default: + throw `Unexpected config name ${name}`; + } + }); + + expect(config.getInputs()).toStrictEqual({ + version: "latest", + args: [], + script: "script.js", + }); + }); }); describe("getPlatform", () => { diff --git a/src/config.ts b/src/config.ts index 7343ef1..fa5461c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -10,7 +10,10 @@ export interface Inputs { export function getInputs(): Inputs { return { version: core.getInput("version") || "latest", - args: core.getInput("args").split(" "), + args: core + .getInput("args") + .split(" ") + .filter((el) => el !== ""), script: core.getInput("script", { required: true }), }; }