Skip to content

Commit

Permalink
tidy up tests containing spawn discussed in https://github.com/substa…
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Sep 2, 2016
1 parent e721508 commit d93d3e3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions test/double_end.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var test = require('tap').test;
var path = require('path');
var concat = require('concat-stream');
var spawn = require('child_process').spawn;

test(function (t) {
t.plan(2);
var ps = spawn(process.execPath,
[ require('path').join(__dirname, 'double_end', 'double.js') ]);
var ps = spawn(process.execPath, [path.join(__dirname, 'double_end', 'double.js')]);
ps.on('exit', function (code) {
t.equal(code, 1);
});
Expand Down
11 changes: 5 additions & 6 deletions test/exit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var tap = require('tap');
var path = require('path');
var spawn = require('child_process').spawn;
var concat = require('concat-stream');

Expand Down Expand Up @@ -26,8 +27,7 @@ tap.test('exit ok', function (t) {
].join('\n'));
}

var ps = spawn(process.execPath,
[ require('path').join(__dirname, 'exit', 'ok.js') ]);
var ps = spawn(process.execPath, [path.join(__dirname, 'exit', 'ok.js')]);
ps.stdout.pipe(concat(tc));
ps.on('exit', function (code) {
t.equal(code, 0);
Expand Down Expand Up @@ -59,8 +59,7 @@ tap.test('exit fail', function (t) {
].join('\n') + '\n\n');
};

var ps = spawn(process.execPath,
[ require('path').join(__dirname, 'exit', 'fail.js') ]);
var ps = spawn(process.execPath, [path.join(__dirname, 'exit', 'fail.js')]);
ps.stdout.pipe(concat(tc));
ps.on('exit', function (code) {
t.notEqual(code, 0);
Expand Down Expand Up @@ -93,7 +92,7 @@ tap.test('too few exit', function (t) {
].join('\n') + '\n\n');
};

var ps = spawn(process.execPath, [ __dirname + '/exit/too_few.js' ]);
var ps = spawn(process.execPath, [path.join(__dirname, '/exit/too_few.js')]);
ps.stdout.pipe(concat(tc));
ps.on('exit', function (code) {
t.notEqual(code, 0);
Expand Down Expand Up @@ -124,7 +123,7 @@ tap.test('more planned in a second test', function (t) {
].join('\n') + '\n\n');
};

var ps = spawn(process.execPath, [ __dirname + '/exit/second.js' ]);
var ps = spawn(process.execPath, [path.join(__dirname, '/exit/second.js')]);
ps.stdout.pipe(concat(tc));
ps.on('exit', function (code) {
t.notEqual(code, 0);
Expand Down
6 changes: 4 additions & 2 deletions test/max_listeners.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var spawn = require('child_process').spawn;
var ps = spawn(process.execPath,
[ require('path').join(__dirname, 'max_listeners', 'source.js') ]);
var path = require('path');

var ps = spawn(process.execPath, [path.join(__dirname, 'max_listeners', 'source.js')]);

ps.stdout.pipe(process.stdout, { end : false });

ps.stderr.on('data', function (buf) {
Expand Down

0 comments on commit d93d3e3

Please sign in to comment.