Skip to content

Commit e806d1e

Browse files
committedMay 17, 2023
fix macos downloads
1 parent 5943168 commit e806d1e

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed
 

‎.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ node_modules
44
*.tar.gz
55
*.log
66
dist
7-
./.bin
7+
.bin/

‎src/install.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export async function download (geckodriverVersion: string = process.env.GECKODR
5454
log.info(`Downloading Geckodriver from ${url}`)
5555
const res = await fetch(url, fetchOpts)
5656

57-
if (!res.body) {
58-
throw new Error(`Failed to download binary (statusCode ${res.status})`)
57+
if (res.status !== 200) {
58+
throw new Error(`Failed to download binary (statusCode ${res.status}): ${res.statusText}`)
5959
}
6060

6161
await fsp.mkdir(targetDir, { recursive: true })

‎src/utils.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ export function getDownloadUrl (version: string) {
1919
: 'linux'
2020
const arch = os.arch() === 'arm64'
2121
? '-aarch64'
22-
: os.arch() === 'x64'
23-
? '64'
24-
: '32'
22+
: platformIdentifier === 'macos'
23+
? ''
24+
: os.arch() === 'x64'
25+
? '64'
26+
: '32'
2527
const ext = os.platform() === 'win32' ? '.zip' : '.tar.gz'
2628
return util.format(GECKODRIVER_DOWNLOAD_PATH, version, version, platformIdentifier, arch, ext)
2729
}

‎tests/__snapshots__/unit.test.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exports[`getDownloadUrl 3`] = `"https://github.com/mozilla/geckodriver/releases/
88

99
exports[`getDownloadUrl 4`] = `"https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-win-aarch64.zip"`;
1010

11-
exports[`getDownloadUrl 5`] = `"https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-macos64.tar.gz"`;
11+
exports[`getDownloadUrl 5`] = `"https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-macos.tar.gz"`;
1212

1313
exports[`getDownloadUrl 6`] = `"https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-macos-aarch64.tar.gz"`;
1414

0 commit comments

Comments
 (0)
Please sign in to comment.