git ssb

0+

cel-desktop / ssb-pkg



Tree: d456a6cc8589489e558e6164750474ed2cfc961e

Files: d456a6cc8589489e558e6164750474ed2cfc961e / test / test-50-bakery-fetch / main.js

825 bytesRaw
1#!/usr/bin/env node
2
3'use strict';
4
5const path = require('path');
6const assert = require('assert');
7const utils = require('../utils.js');
8const fetch = require('pkg-fetch');
9
10assert(!module.parent);
11assert(__dirname === process.cwd());
12
13const host = 'node' + process.version.match(/^v(\d+)/)[1];
14const target = process.argv[2] || host;
15
16let right;
17
18fetch.need({
19 nodeRange: target,
20 platform: fetch.system.hostPlatform,
21 arch: fetch.system.hostArch
22}).then(function (needed) {
23 right = utils.spawn.sync(
24 './' + path.basename(needed),
25 [ '--expose-gc',
26 '-e', 'if (global.gc) console.log("ok");' ],
27 { cwd: path.dirname(needed),
28 env: { PKG_EXECPATH: 'PKG_INVOKE_NODEJS' } }
29 );
30
31 assert.equal(right, 'ok\n');
32}).catch(function (error) {
33 console.error(`> ${error.message}`);
34 process.exit(2);
35});
36

Built with git-ssb-web