Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-50-public-packages / main.js
837 bytesRaw
1 | |
2 | |
3 | 'use strict'; |
4 | |
5 | const path = require('path'); |
6 | const assert = require('assert'); |
7 | const utils = require('../utils.js'); |
8 | |
9 | assert(!module.parent); |
10 | assert(__dirname === process.cwd()); |
11 | |
12 | const host = 'node' + process.version.match(/^v(\d+)/)[1]; |
13 | const target = process.argv[2] || host; |
14 | const input = './test-x-index.js'; |
15 | const output = './test-output.exe'; |
16 | |
17 | if (/^(node|v)?0/.test(target)) return; |
18 | |
19 | for (const pub of [ 'swordsman', 'crusader', '*' ]) { |
20 | let right; |
21 | |
22 | utils.pkg.sync([ |
23 | '--public-packages=' + pub, |
24 | '--target', target, |
25 | '--output', output, input |
26 | ]); |
27 | |
28 | right = utils.spawn.sync( |
29 | './' + path.basename(output), [], |
30 | { cwd: path.dirname(output) } |
31 | ); |
32 | |
33 | if (pub === 'swordsman') { |
34 | assert.equal(right, ''); |
35 | } else { |
36 | assert.equal(right, 'ok\n'); |
37 | } |
38 | |
39 | utils.vacuum.sync(output); |
40 | } |
41 |
Built with git-ssb-web