Files: cfc8d49135488f7554210234b3a503c2dbd6c6a5 / test / test-42-path-related-values / main.js
1401 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 target = process.argv[2] || 'host'; |
13 | const input = './project/app.js'; |
14 | const output = './deploy/app-x64.exe'; |
15 | |
16 | let left, right; |
17 | utils.mkdirp.sync(path.dirname(output)); |
18 | |
19 | left = utils.spawn.sync( |
20 | 'node', [ path.basename(input) ], |
21 | { cwd: path.dirname(input) } |
22 | ); |
23 | |
24 | utils.pkg.sync([ |
25 | '--target', target, |
26 | '--output', output, input |
27 | ], { stdio: 'inherit' }); |
28 | |
29 | right = utils.spawn.sync( |
30 | './' + path.basename(output), [], |
31 | { cwd: path.dirname(output) } |
32 | ); |
33 | |
34 | left = JSON.parse(left); |
35 | right = JSON.parse(right); |
36 | |
37 | for (let obj of [ left, right ]) { |
38 | for (let s in obj) { |
39 | obj[s] = obj[s].replace('/home/travis/build', '') |
40 | .replace('/home/travis/.nvm/versions', '') |
41 | .replace('\\pkg\\test\\test-42-path-related-values', '') |
42 | .replace('/pkg/test/test-42-path-related-values', '') |
43 | .replace('app-x64.exe', 'app-x64'); |
44 | } |
45 | } |
46 | |
47 | function pad (s, width) { |
48 | const p = width > s.length ? width - s.length : 1; |
49 | return s + ' '.repeat(p); |
50 | } |
51 | |
52 | console.log('-'.repeat(78)); |
53 | for (let s in left) { |
54 | console.log(pad(s, 30), '|', pad(left[s], 36), '|', right[s]); |
55 | } |
56 | console.log('-'.repeat(78)); |
57 | |
58 | utils.vacuum.sync(path.dirname(output)); |
59 |
Built with git-ssb-web