git ssb

0+

cel-desktop / ssb-pkg



Tree: 65191f9a9664f013ebe726bb95a1a54b086e1bd5

Files: 65191f9a9664f013ebe726bb95a1a54b086e1bd5 / test / test-50-ast-parsing-2 / main.js

1224 bytesRaw
1#!/usr/bin/env node
2
3'use strict';
4
5const fs = require('fs');
6const assert = require('assert');
7const utils = require('../utils.js');
8
9assert(!module.parent);
10assert(__dirname === process.cwd());
11
12const target = process.argv[2] || 'host';
13const input = './test-x-index.js';
14const output = './test-output.exe';
15const standard = 'stdout';
16
17let left, right;
18
19left = 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
27const inspect = (standard === 'stdout')
28 ? [ 'inherit', 'pipe', 'inherit' ]
29 : [ 'inherit', 'inherit', 'pipe' ];
30
31right = utils.pkg.sync([
32 '--debug',
33 '--target', target,
34 '--output', output, input
35], inspect);
36
37assert(right.indexOf('\x1B\x5B') < 0, 'colors detected');
38
39const rightLines = [];
40right.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
52right = rightLines.join('\n') + '\n';
53assert.equal(left, right);
54utils.vacuum.sync(output);
55

Built with git-ssb-web