Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-42-fetch-all / main.js
1366 bytesRaw
1 | |
2 | |
3 | 'use strict'; |
4 | |
5 | const assert = require('assert'); |
6 | const fetch = require('pkg-fetch'); |
7 | const dontBuild = require('pkg-fetch/lib-es5/upload.js').dontBuild; |
8 | const knownPlatforms = fetch.system.knownPlatforms; |
9 | const items = []; |
10 | |
11 | function nodeRangeToNodeVersion (nodeRange) { |
12 | assert(/^node/.test(nodeRange)); |
13 | return 'v' + nodeRange.slice(4); |
14 | } |
15 | |
16 | |
17 | for (const platform of knownPlatforms) { |
18 | const nodeRanges = [ 'node8', 'node10', 'node12' ]; |
19 | if (platform === 'linux' || platform === 'alpine') nodeRanges.unshift('node6'); |
20 | if (platform === 'linux') nodeRanges.unshift('node4'); |
21 | for (const nodeRange of nodeRanges) { |
22 | const nodeVersion = nodeRangeToNodeVersion(nodeRange); |
23 | const archs = [ 'x64' ]; |
24 | if (platform === 'win') archs.unshift('x86'); |
25 | if (platform === 'linux') archs.push('armv7'); |
26 | // linux-armv7 is needed in multi-arch tests, |
27 | // so keeping it here as obligatory. but let's |
28 | // leave compiling for freebsd to end users |
29 | if (platform === 'freebsd') continue; |
30 | for (const arch of archs) { |
31 | if (dontBuild(nodeVersion, platform, arch)) continue; |
32 | items.push({ nodeRange, platform, arch }); |
33 | } |
34 | } |
35 | } |
36 | |
37 | let p = Promise.resolve(); |
38 | items.forEach((item) => { |
39 | p = p.then(() => fetch.need(item)); |
40 | }); |
41 | |
42 | p.catch((error) => { |
43 | if (!error.wasReported) console.log(`> ${error}`); |
44 | process.exit(2); |
45 | }); |
46 |
Built with git-ssb-web