Skip to content

Commit 7e559c0

Browse files
committed
fix: fix the version check for vcpkg
1 parent 040d331 commit 7e559c0

File tree

8 files changed

+23
-15
lines changed

8 files changed

+23
-15
lines changed

dist/actions/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/vcpkg/__tests__/vcpkg.test.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
1-
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
1+
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
22
import { setupVcpkg } from "../vcpkg"
33

44
jest.setTimeout(300000)
5-
async function testVcpkg(directory: string) {
6-
const { binDir } = await setupVcpkg("", directory, "")
7-
await testBin("vcpkg", ["--version"], binDir)
8-
return binDir
9-
}
105

116
describe("setup-vcpkg", () => {
127
let directory: string
13-
beforeAll(async () => {
8+
beforeEach(async () => {
149
directory = await setupTmpDir("vcpkg")
1510
})
1611

1712
it("should setup vcpkg", async () => {
18-
await testVcpkg(directory)
13+
console.log(!("true" in ["", "true"]))
14+
const { binDir } = await setupVcpkg("", directory, "")
15+
await testBin("vcpkg", ["--version"], binDir)
16+
return binDir
17+
})
18+
19+
it("should setup vcpkg with specific version", async () => {
20+
const { binDir } = await setupVcpkg("e590c2b30c08caf1dd8d612ec602a003f9784b7d", directory, "")
21+
await testBin("vcpkg", ["--version"], binDir)
22+
return binDir
23+
})
24+
25+
afterEach(async () => {
26+
await cleanupTmpDir(directory)
1927
})
2028
})

src/vcpkg/vcpkg.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function setupVcpkg(version: string, setupDir: string, _arch: strin
5858
}
5959

6060
// if version specified, checkout the version
61-
if (!(version in ["", "true"])) {
61+
if (version !== "" && version !== "true") {
6262
info(`Checking out vcpkg version ${version}`)
6363
execaSync("git", ["checkout", version], {
6464
cwd: setupDir,

0 commit comments

Comments
 (0)