Skip to content

Commit

Permalink
give travis more time to spawn child processes
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Mar 27, 2015
1 parent 07e7338 commit c39c4ee
Showing 1 changed file with 18 additions and 33 deletions.
51 changes: 18 additions & 33 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test(cyan('Spawn a Parent process which has a Two Child Processes'), function (t
t.equal(children.length, 0, green("✓ No more active child processes (we killed them)"));
t.end();
})
},500); // give psTree time to kill the processes
},1000); // give psTree time to kill the processes
},200); // give the child process time to spawn
});

Expand All @@ -46,36 +46,21 @@ test(cyan('FORCE ERROR by calling psTree without supplying a Callback'), functio

test(cyan('Spawn a Child Process and psTree with a String as pid'), function (t) {
var child = cp.exec("node ./test/exec/child.js", function(error, stdout, stderr) { });
psTree(child.pid.toString(), function (err, children) {
if(err){
console.log(err);
}
// t.equal(children.length, 1, green("✓ No more active child processes"));
cp.spawn('kill', ['-9'].concat(children.map(function (p) { return p.PID })))
})
psTree(child.pid.toString(), function (err, children) {
if(err){
console.log(err);
}
t.equal(children.length, 0, green("✓ No more active child processes"));
t.end();
})
setTimeout(function(){
psTree(child.pid.toString(), function (err, children) {
if(err){
console.log(err);
}
cp.spawn('kill', ['-9'].concat(children.map(function (p) { return p.PID })))
})
setTimeout(function() {
psTree(child.pid.toString(), function (err, children) {
if(err){
console.log(err);
}
t.equal(children.length, 0, green("✓ No more active child processes"));
t.end();
});
},1000); // give psTree time to kill the processes
},200); // give the child process time to spawn
});

// test(cyan('Spawn a Child Process while true'), function (t) {
// var child = cp.exec("node -e 'while (true);", function(error, stdout, stderr) { });
// psTree(child.pid, function (err, children) {
// if(err){
// console.log(err);
// }
// // t.equal(children.length, 1, green("✓ No more active child processes"));
// cp.spawn('kill', ['-9'].concat(children.map(function (p) { return p.PID })))
// })
// psTree(child.pid.toString(), function (err, children) {
// if(err){
// console.log(err);
// }
// t.equal(children.length, 0, green("✓ No more active child processes"));
// t.end();
// })
// });

0 comments on commit c39c4ee

Please sign in to comment.