fix: fix the version check for vcpkg

This commit is contained in:
Amin Yahyaabadi 2024-08-12 02:19:44 -07:00
parent 040d33199e
commit 7e559c044f
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
8 changed files with 23 additions and 15 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,20 +1,28 @@
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers" import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { setupVcpkg } from "../vcpkg" import { setupVcpkg } from "../vcpkg"
jest.setTimeout(300000) jest.setTimeout(300000)
async function testVcpkg(directory: string) {
const { binDir } = await setupVcpkg("", directory, "")
await testBin("vcpkg", ["--version"], binDir)
return binDir
}
describe("setup-vcpkg", () => { describe("setup-vcpkg", () => {
let directory: string let directory: string
beforeAll(async () => { beforeEach(async () => {
directory = await setupTmpDir("vcpkg") directory = await setupTmpDir("vcpkg")
}) })
it("should setup vcpkg", async () => { it("should setup vcpkg", async () => {
await testVcpkg(directory) console.log(!("true" in ["", "true"]))
const { binDir } = await setupVcpkg("", directory, "")
await testBin("vcpkg", ["--version"], binDir)
return binDir
})
it("should setup vcpkg with specific version", async () => {
const { binDir } = await setupVcpkg("e590c2b30c08caf1dd8d612ec602a003f9784b7d", directory, "")
await testBin("vcpkg", ["--version"], binDir)
return binDir
})
afterEach(async () => {
await cleanupTmpDir(directory)
}) })
}) })

View File

@ -58,7 +58,7 @@ export async function setupVcpkg(version: string, setupDir: string, _arch: strin
} }
// if version specified, checkout the version // if version specified, checkout the version
if (!(version in ["", "true"])) { if (version !== "" && version !== "true") {
info(`Checking out vcpkg version ${version}`) info(`Checking out vcpkg version ${version}`)
execaSync("git", ["checkout", version], { execaSync("git", ["checkout", version], {
cwd: setupDir, cwd: setupDir,