-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: misc test fixes * Sort test runs by os first * Use cross-env for test env var * Try sorting matrix params * Make FAST_TEST the default and rename to FULL_TEST * Separate helper functions to not need to export test obj in files
- Loading branch information
1 parent
d52997e
commit 4e493d4
Showing
18 changed files
with
239 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const fetch = require('make-fetch-happen') | ||
const { promises: fs } = require('graceful-fs') | ||
const log = require('./log') | ||
|
||
async function download (gyp, url) { | ||
log.http('GET', url) | ||
|
||
const requestOpts = { | ||
headers: { | ||
'User-Agent': `node-gyp v${gyp.version} (node ${process.version})`, | ||
Connection: 'keep-alive' | ||
}, | ||
proxy: gyp.opts.proxy, | ||
noProxy: gyp.opts.noproxy | ||
} | ||
|
||
const cafile = gyp.opts.cafile | ||
if (cafile) { | ||
requestOpts.ca = await readCAFile(cafile) | ||
} | ||
|
||
const res = await fetch(url, requestOpts) | ||
log.http(res.status, res.url) | ||
|
||
return res | ||
} | ||
|
||
async function readCAFile (filename) { | ||
// The CA file can contain multiple certificates so split on certificate | ||
// boundaries. [\S\s]*? is used to match everything including newlines. | ||
const ca = await fs.readFile(filename, 'utf8') | ||
const re = /(-----BEGIN CERTIFICATE-----[\S\s]*?-----END CERTIFICATE-----)/g | ||
return ca.match(re) | ||
} | ||
|
||
module.exports = { | ||
download, | ||
readCAFile | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.