var cp = require('child_process');
var join = require('path').join;
var walk = require('walk');
var mochaBin = join(__dirname, '..', 'node_modules', '.bin', 'mocha');
var _ = require('underscore');

var exitCodes = [];
var walker = walk.walk(__dirname + '/spec', {followLinks: false});
walker.on('file', function(root, stat, next) {
  var filepath = root + '/' + stat.name;
  var result = cp.spawnSync(mochaBin, [filepath], {stdio: 'inherit'});
  exitCodes.push(result.status);
  next();
});

walker.on('end', function() {
  var hasFailures = _.some(exitCodes, function(status) {
    return status !== 0;
  });
  if (hasFailures) {
    process.exit(1);
  }
});

var cp = require('child_process');
var join = require('path').join;
var walk = require('walk');
var mochaBin = join(__dirname, '..', 'node_modules', '.bin', 'mocha');
var _ = require('underscore');

var exitCodes = [];
var walker = walk.walk(__dirname + '/spec', {followLinks: false});
walker.on('file', function(root, stat, next) {
  var filepath = root + '/' + stat.name;
  var result = cp.spawnSync(mochaBin, [filepath], {stdio: 'inherit'});
  exitCodes.push(result.status);
  next();
});

walker.on('end', function() {
  var failures = _.filter(exitCodes, function(status) {
    return status !== 0;
  });
  if (failures.length) {
    process.exit(1);
  }
});

--- 
+++ 
@@ -14,10 +14,10 @@
 });
 
 walker.on('end', function() {
-  var failures = _.filter(exitCodes, function(status) {
+  var hasFailures = _.some(exitCodes, function(status) {
     return status !== 0;
   });
-  if (failures.length) {
+  if (hasFailures) {
     process.exit(1);
   }
 });
Use some instead of filter
