diff --git a/src/brew/__tests__/brew.test.ts b/src/brew/__tests__/brew.test.ts index 6896c36f..d7d31c1c 100644 --- a/src/brew/__tests__/brew.test.ts +++ b/src/brew/__tests__/brew.test.ts @@ -9,6 +9,6 @@ describe("setup-brew", () => { return } const installInfo = setupBrew("", "", "") - await testBin("brew", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir) + await testBin("brew", ["--version"], installInfo?.binDir) }) }) diff --git a/src/brew/brew.ts b/src/brew/brew.ts index feb79bf3..7684b8aa 100644 --- a/src/brew/brew.ts +++ b/src/brew/brew.ts @@ -6,7 +6,7 @@ let binDir: string | undefined // eslint-disable-next-line @typescript-eslint/no-unused-vars export function setupBrew(_version: string, _setupCppDir: string, _arch: string) { if (!["darwin", "linux"].includes(process.platform)) { - return + return undefined } if (typeof binDir === "string") { return { binDir } diff --git a/src/utils/tests/test-helpers.ts b/src/utils/tests/test-helpers.ts index 44f5f0de..8ceded1c 100644 --- a/src/utils/tests/test-helpers.ts +++ b/src/utils/tests/test-helpers.ts @@ -1,9 +1,9 @@ import * as io from "@actions/io" import { tmpdir } from "os" import * as path from "path" -import { spawnSync as spawn } from "child_process" import { addBinExtension } from "../setup/setupBin" import { join } from "path" +import { exec } from "@actions/exec" export async function setupTmpDir(testName: string) { const tempDirectory = path.join(tmpdir(), "setup-cpp", testName) @@ -41,9 +41,7 @@ export async function testBin(name: string, args: string[] = ["--version"], binD bin = join(binDir, addBinExtension(name)) } - const { status } = spawn(bin, args, { - encoding: "utf8", - }) + const status = await exec(bin, args) expect(status).toBe(0) expect(await io.which(name, true)).toBe(bin)