git ssb

0+

cel-desktop / ssb-pkg



Tree: efcf9fd06b02fa9bcd28681b4c777224e19702bb

Files: efcf9fd06b02fa9bcd28681b4c777224e19702bb / test / test-50-path-as-buffer / main.js

1454 bytesRaw
1#!/usr/bin/env node
2
3/* eslint-disable no-multi-spaces */
4
5'use strict';
6
7const path = require('path');
8const assert = require('assert');
9const utils = require('../utils.js');
10
11assert(!module.parent);
12assert(__dirname === process.cwd());
13
14const host = 'node' + process.version.match(/^v(\d+)/)[1];
15const target = process.argv[2] || host;
16const input = './test-x-index.js';
17const output = './test-output.exe';
18
19function bitty (version) {
20 return (2 * (/^(node|v)?4/.test(version))) |
21 (2 * (/^(node|v)?5/.test(version))) |
22 (2 * (/^(node|v)?6/.test(version))) |
23 (2 * (/^(node|v)?7/.test(version))) |
24 (2 * (/^(node|v)?8/.test(version))) | // 2 = doesn't have URL
25 (4 * (/^(node|v)?9/.test(version))) |
26 (4 * (/^(node|v)?10/.test(version))) |
27 (4 * (/^(node|v)?11/.test(version))) |
28 (4 * (/^(node|v)?12/.test(version))) |
29 (4 * (/^(node|v)?13/.test(version))) |
30 (4 * (/^(node|v)?14/.test(version))); // 4 = has URL
31}
32
33const version1 = process.version;
34const version2 = target;
35if (bitty(version1) !== bitty(version2)) return;
36
37let left, right;
38
39left = utils.spawn.sync(
40 'node', [ path.basename(input) ],
41 { cwd: path.dirname(input) }
42);
43
44utils.pkg.sync([
45 '--target', target,
46 '--output', output, input
47]);
48
49right = utils.spawn.sync(
50 './' + path.basename(output), [],
51 { cwd: path.dirname(output) }
52);
53
54assert.equal(left, right);
55utils.vacuum.sync(output);
56

Built with git-ssb-web