Skip to content

Commit abb5917

Browse files
committed
test: do not spawn OpenCppCoverage due to its non-zero exit codes
1 parent 78ad81e commit abb5917

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/opencppcoverage/__tests__/opencppcoverage.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ describe("setup-OpenCppCoverage", () => {
99
}
1010
await setupOpencppcoverage("", "", process.arch)
1111

12-
await testBin("OpenCppCoverage")
12+
await testBin("OpenCppCoverage", null) // OpenCppCoverage exits with non-zero even with --help
1313
})
1414
})

src/utils/tests/test-helpers.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,22 @@ export async function cleanupTmpDir(testName: string) {
3636
}
3737
}
3838

39-
export async function testBin(name: string, args: string[] = ["--version"], binDir: string | undefined = undefined) {
39+
export async function testBin(
40+
name: string,
41+
args: string[] | null = ["--version"],
42+
binDir: string | undefined = undefined
43+
) {
4044
let bin = name
4145
if (typeof binDir === "string") {
4246
expect(binDir).toBeDefined()
4347
expect(binDir).not.toHaveLength(0)
4448
bin = join(binDir, addBinExtension(name))
4549
}
4650

47-
const status = await exec(escape(bin) as string, args)
48-
expect(status).toBe(0)
51+
if (args !== null) {
52+
const status = await exec(escape(bin) as string, args)
53+
expect(status).toBe(0)
54+
}
4955

5056
expect(await io.which(name, true)).toBe(bin)
5157
}

0 commit comments

Comments
 (0)