Skip to content

Commit

Permalink
fix issue where all mutants appear alive in child mocha reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
bttmly committed Sep 3, 2015
1 parent 6106256 commit b1f6d05
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 34 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"parser": "babel-eslint",
"env": {
"node": 1,
"mocha": 1
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ events:
dogfood:
NODE_ENV=testing ./bin/perturb --rootDir ./ --testCmd 'make test'

dogfood-child:
NODE_ENV=testing ./bin/perturb --rootDir ./ --testCmd 'make test' --runner mochaChild

dogfood-parallel:
NODE_ENV=testing ./bin/perturb --rootDir ./ --testCmd 'make test' --runner mochaChild --parallel

Expand Down
2 changes: 1 addition & 1 deletion bin/_perturb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ program
.option("-v, --verbose", "lots of logging")
.option("-k, --killRate", "minimum kill rate to exit with code 0")
.option("-p, --parallel", "run mutants in parallel (careful!)")
.option("-u, --runner <runner>")
.option("-u, --runner <runner>", "name of runner or runner plugin")
.parse(process.argv);

if (program.rootDir && program.rootDir[0] !== "/") {
Expand Down
18 changes: 3 additions & 15 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@
// Error.stackTraceLimit = 100;
// process.setMaxListeners(0);

console.log("TYPEOF LOG", typeof console.log);

process.on("newListener", function () {
// console.log("NEW LISTENER:", process._events);
});

// process.on("removeListener", function () {
// console.log("REMOVE LISTENER");
// console.trace();
// });

process.env.PERTURB = true;

var assert = require("assert");
Expand Down Expand Up @@ -96,10 +85,9 @@ function makeSourceGroupHandler (config) {
var sourceCode = mutants[0].sourceCode;
var sourceFile = mutants[0].sourceFile;

var mapMethod = config.parallel ? async.map : async.mapSeries;

console.log(sourceFile, "starting....");
mapMethod(mutants, runMutant(config), function (err, processedMutants) {
// var mapMethod = config.parallel ? async.map : async.mapSeries;

async.mapSeries(mutants, runMutant(config), function (err, processedMutants) {
if (err) {
console.log("ERR!", err);
return done(err);
Expand Down
1 change: 0 additions & 1 deletion lib/run-mutant.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function createMultiMutantRunner (config) {
var last = finish(config, _done);
var tests = mutant.testFiles.slice();

console.log("RUNNER:", config.runner);
var runner = runners[config.runner || DEFAULT_RUNNER];
if (runner == null) {
throw new Error(ERRORS.InvalidReporter);
Expand Down
18 changes: 1 addition & 17 deletions lib/runners/mocha-child.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,8 @@ function mochaChildProcessRunner (testFile, done) {
var exited;

var child = exec(cmd, opts, function (err, stdout, stderr) {
// if (!exited && err) {
// console.log("child error callback");
// exited = true;
// return done(err.toString());
// }

console.log("CHILD EXITED WITH 0?", child.exitCode === 0, err);
done();
});

child.on("error", function (err) {
console.log("child error event");
if (!exited) {
exited = true;
done(err.toString())
}
done(err);
});

}

module.exports = mochaChildProcessRunner;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"object-assign": "^2.0.0"
},
"devDependencies": {
"babel-eslint": "^4.1.1",
"chai": "^1.10.0",
"growl": "^1.8.1",
"jshint": "^2.6.0",
Expand Down

0 comments on commit b1f6d05

Please sign in to comment.