Files: cfc8d49135488f7554210234b3a503c2dbd6c6a5 / test / test-50-error-source-position / main.js
843 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 | let right; |
18 | |
19 | utils.pkg.sync([ |
20 | '--public', |
21 | '--target', target, |
22 | '--output', output, input |
23 | ]); |
24 | |
25 | right = utils.spawn.sync( |
26 | './' + path.basename(output), [], |
27 | { cwd: path.dirname(output), |
28 | stdio: 'pipe', expect: 1 } |
29 | ); |
30 | |
31 | if (!(/^(node|v)?0/.test(target))) { |
32 | assert(right.stderr.indexOf('x.parse is not a function') >= 0); |
33 | } |
34 | |
35 | const errorPointer = 'x.parse();' + require('os').EOL + ' ^'; |
36 | assert(right.stderr.indexOf(errorPointer) >= 0); |
37 | utils.vacuum.sync(output); |
38 |
Built with git-ssb-web