diff --git a/packages/setup-apt/__tests__/apt-fast.test.ts b/packages/setup-apt/__tests__/apt-fast.test.ts index 60d4babe..b1bc1266 100644 --- a/packages/setup-apt/__tests__/apt-fast.test.ts +++ b/packages/setup-apt/__tests__/apt-fast.test.ts @@ -9,6 +9,6 @@ describe("setup-apt-fast", () => { } it("should setup apt-fast", async () => { const installInfo = await setupAptFast() - await testBin("apt-fast", ["--version"], installInfo?.binDir) + await testBin("apt-fast", null, installInfo?.binDir) }) }) diff --git a/packages/setup-apt/__tests__/testBin.ts b/packages/setup-apt/__tests__/testBin.ts index edd809c0..09d78517 100644 --- a/packages/setup-apt/__tests__/testBin.ts +++ b/packages/setup-apt/__tests__/testBin.ts @@ -1,7 +1,6 @@ import spawn from "cross-spawn" import { pathExists } from "path-exists" -import { join } from "path/posix" -import { addExeExt } from "patha" +import { addExeExt, join } from "patha" import which from "which" export async function testBin( @@ -9,24 +8,20 @@ export async function testBin( args: string[] | null = ["--version"], binDir: string | undefined = undefined, ) { - try { - let bin = name - if (typeof binDir === "string") { - console.log(`Testing the existence of ${binDir}`) - expect(binDir).toBeDefined() - expect(binDir).not.toHaveLength(0) - expect(await pathExists(binDir)).toBeTruthy() - bin = join(binDir, addExeExt(name)) - } - - if (args !== null) { - console.log(`Running ${bin} ${args.join(" ")}`) - const { status } = spawn.sync(bin, args, { stdio: "inherit" }) - expect(status).toBe(0) - } - - expect((await which(name, { nothrow: true }))?.includes(bin)) - } catch (err) { - throw new Error(`Failed to test bin ${name}: ${err}`) + let bin = name + if (typeof binDir === "string") { + console.log(`Testing the existence of ${binDir}`) + expect(binDir).toBeDefined() + expect(binDir).not.toHaveLength(0) + expect(await pathExists(binDir)).toBeTruthy() + bin = join(binDir, addExeExt(name)) } + + if (args !== null) { + console.log(`Running ${bin} ${args.join(" ")}`) + const { status } = spawn.sync(bin, args, { stdio: "inherit" }) + expect(status).toBe(0) + } + + expect((await which(name, { nothrow: true }))?.includes(bin)) }