test: do not spawn OpenCppCoverage due to its non-zero exit codes

This commit is contained in:
Amin Yahyaabadi 2021-09-17 05:06:14 -05:00
parent 78ad81e393
commit abb5917b83
2 changed files with 10 additions and 4 deletions

View File

@ -9,6 +9,6 @@ describe("setup-OpenCppCoverage", () => {
} }
await setupOpencppcoverage("", "", process.arch) await setupOpencppcoverage("", "", process.arch)
await testBin("OpenCppCoverage") await testBin("OpenCppCoverage", null) // OpenCppCoverage exits with non-zero even with --help
}) })
}) })

View File

@ -36,7 +36,11 @@ export async function cleanupTmpDir(testName: string) {
} }
} }
export async function testBin(name: string, args: string[] = ["--version"], binDir: string | undefined = undefined) { export async function testBin(
name: string,
args: string[] | null = ["--version"],
binDir: string | undefined = undefined
) {
let bin = name let bin = name
if (typeof binDir === "string") { if (typeof binDir === "string") {
expect(binDir).toBeDefined() expect(binDir).toBeDefined()
@ -44,8 +48,10 @@ export async function testBin(name: string, args: string[] = ["--version"], binD
bin = join(binDir, addBinExtension(name)) bin = join(binDir, addBinExtension(name))
} }
if (args !== null) {
const status = await exec(escape(bin) as string, args) const status = await exec(escape(bin) as string, args)
expect(status).toBe(0) expect(status).toBe(0)
}
expect(await io.which(name, true)).toBe(bin) expect(await io.which(name, true)).toBe(bin)
} }