Files: c5c7a8ffadbd51aa28a5f3f096fe43f69405da44 / test / test-50-ast-parsing-2 / main.js
1224 bytesRaw
1 | |
2 | |
3 | 'use strict'; |
4 | |
5 | const fs = require('fs'); |
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 = './test-x-index.js'; |
14 | const output = './test-output.exe'; |
15 | const standard = 'stdout'; |
16 | |
17 | let left, right; |
18 | |
19 | left = fs.readFileSync( |
20 | input, 'utf8' |
21 | ).split('\n').filter(function (line) { |
22 | return line.indexOf('/**/') >= 0; |
23 | }).map(function (line) { |
24 | return line.split('/**/')[1]; |
25 | }).join('\n') + '\n'; |
26 | |
27 | const inspect = (standard === 'stdout') |
28 | ? [ 'inherit', 'pipe', 'inherit' ] |
29 | : [ 'inherit', 'inherit', 'pipe' ]; |
30 | |
31 | right = utils.pkg.sync([ |
32 | '--debug', |
33 | '--target', target, |
34 | '--output', output, input |
35 | ], inspect); |
36 | |
37 | assert(right.indexOf('\x1B\x5B') < 0, 'colors detected'); |
38 | |
39 | const rightLines = []; |
40 | right.split('\n').some(function (line) { |
41 | let s = line.split('Cannot resolve \'')[1]; |
42 | if (s) { |
43 | rightLines.push(s.slice(0, -(')').length)); |
44 | return; |
45 | } |
46 | s = line.split('Path.resolve(')[1]; |
47 | if (s) { |
48 | rightLines.push(s.slice(0, -(') is ambiguous').length)); |
49 | } |
50 | }); |
51 | |
52 | right = rightLines.join('\n') + '\n'; |
53 | assert.equal(left, right); |
54 | utils.vacuum.sync(output); |
55 |
Built with git-ssb-web