test: simplify cmake test

This commit is contained in:
Amin Yahyaabadi 2021-09-16 14:38:52 -05:00
parent b492a11246
commit 0705a52b46
2 changed files with 4 additions and 9 deletions

View File

@ -2,11 +2,6 @@ import { setupCmake } from "../cmake"
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers" import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
jest.setTimeout(200000) jest.setTimeout(200000)
async function testCmake(directory: string) {
const { binDir } = await setupCmake("3.20.2", directory, "")
await testBin("cmake", ["--version"], binDir)
return binDir
}
describe("setup-cmake", () => { describe("setup-cmake", () => {
let directory: string let directory: string
@ -15,11 +10,13 @@ describe("setup-cmake", () => {
}) })
it("should setup CMake", async () => { it("should setup CMake", async () => {
await testCmake(directory) const { binDir } = await setupCmake("3.20.2", directory, "")
await testBin("cmake", ["--version"], binDir)
}) })
it("should find CMake in the cache", async () => { it("should find CMake in the cache", async () => {
const binDir = await testCmake(directory) const { binDir } = await setupCmake("3.20.2", directory, "")
await testBin("cmake", ["--version"], binDir)
expect(binDir.includes("ToolCache")).toBeTruthy() expect(binDir.includes("ToolCache")).toBeTruthy()
}) })

View File

@ -47,6 +47,4 @@ export async function testBin(name: string, args: string[] = ["--version"], binD
expect(status).toBe(0) expect(status).toBe(0)
expect(await io.which(name, true)).toBe(bin) expect(await io.which(name, true)).toBe(bin)
return binDir
} }