-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
bin_tr_error.js
27 lines (24 loc) · 1.01 KB
/
bin_tr_error.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var browserify = require('../');
var spawn = require('child_process').spawn;
var test = require('tap').test;
var path = require('path')
var semver = require('semver');
// TODO this should be fixable I guess
var flaky = process.platform === 'win32' && semver.satisfies(process.version, 'v0.10.x');
test('function transform', { skip: flaky }, function (t) {
t.plan(3);
var ps = spawn(process.execPath, [
path.resolve(__dirname, '../bin/cmd.js'),
'-t', './tr.js', './main.js'
], {cwd: path.resolve(__dirname, 'bin_tr_error')});
var src = '';
var err = '';
ps.stdout.on('data', function (buf) { src += buf });
ps.stderr.on('data', function (buf) { err += buf });
ps.on('exit', function (code) {
t.notEqual(code, 0);
var errorFile = path.resolve(__dirname, 'bin_tr_error', 'tr.js');
t.notEqual(err.indexOf('there was error'), -1, 'Error should contain error message')
t.notEqual(err.indexOf(errorFile), -1, 'Error should contain stack trace')
});
});