test: pass the install directory for powershell

This commit is contained in:
Amin Yahyaabadi 2024-08-21 15:29:27 -07:00
parent 20c025d4d7
commit c2afe421b0
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
9 changed files with 20 additions and 10 deletions

View File

@ -84,7 +84,7 @@ jobs:
- windows-2022
- ubuntu-24.04
- macos-13
- macos-12
# - macos-12
node:
- 22
pnpm:

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,18 +1,28 @@
import { GITHUB_ACTIONS } from "ci-info"
import { testBin } from "../../utils/tests/test-helpers.js"
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers.js"
import { getVersion } from "../../versions/versions.js"
import { setupPowershell } from "../powershell.js"
jest.setTimeout(300000)
describe("setup-powershell", () => {
let directory: string
beforeEach(async () => {
directory = await setupTmpDir("powershell")
process.env.CACHE_TOOLS = "true"
})
it("should setup powershell", async () => {
if (process.platform === "win32" && GITHUB_ACTIONS) {
// results in errors
return
}
const installInfo = await setupPowershell(getVersion("powershell", undefined), "", process.arch)
const installInfo = await setupPowershell(getVersion("powershell", undefined), directory, process.arch)
await testBin("pwsh", ["--version"], installInfo.binDir)
})
afterEach(async () => {
await cleanupTmpDir("ninja")
}, 100000)
})

View File

@ -137,7 +137,7 @@ async function tryDownload(name: string, version: string, url: string) {
info(`Download ${name} ${version}`)
// try to download the package 4 times with 2 seconds delay
const downloaded = await retry(
async () => {
() => {
const downloadedFilePath = join(process.env.RUNNER_TEMP ?? tmpdir(), `${Date.now()}-${basename(url)}`)
return downloadTool(url, downloadedFilePath)