Skip to content

Commit c2afe42

Browse files
committed
test: pass the install directory for powershell
1 parent 20c025d commit c2afe42

File tree

9 files changed

+20
-10
lines changed

9 files changed

+20
-10
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
- windows-2022
8585
- ubuntu-24.04
8686
- macos-13
87-
- macos-12
87+
# - macos-12
8888
node:
8989
- 22
9090
pnpm:

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.
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
import { GITHUB_ACTIONS } from "ci-info"
2-
import { testBin } from "../../utils/tests/test-helpers.js"
2+
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers.js"
33
import { getVersion } from "../../versions/versions.js"
44
import { setupPowershell } from "../powershell.js"
55

66
jest.setTimeout(300000)
77
describe("setup-powershell", () => {
8+
let directory: string
9+
beforeEach(async () => {
10+
directory = await setupTmpDir("powershell")
11+
process.env.CACHE_TOOLS = "true"
12+
})
13+
814
it("should setup powershell", async () => {
915
if (process.platform === "win32" && GITHUB_ACTIONS) {
1016
// results in errors
1117
return
1218
}
1319

14-
const installInfo = await setupPowershell(getVersion("powershell", undefined), "", process.arch)
20+
const installInfo = await setupPowershell(getVersion("powershell", undefined), directory, process.arch)
1521

1622
await testBin("pwsh", ["--version"], installInfo.binDir)
1723
})
24+
25+
afterEach(async () => {
26+
await cleanupTmpDir("ninja")
27+
}, 100000)
1828
})

src/utils/setup/setupBin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ async function tryDownload(name: string, version: string, url: string) {
137137
info(`Download ${name} ${version}`)
138138
// try to download the package 4 times with 2 seconds delay
139139
const downloaded = await retry(
140-
async () => {
140+
() => {
141141
const downloadedFilePath = join(process.env.RUNNER_TEMP ?? tmpdir(), `${Date.now()}-${basename(url)}`)
142142

143143
return downloadTool(url, downloadedFilePath)

0 commit comments

Comments
 (0)