Skip to content

Commit

Permalink
back to spawn; but with mocha.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler committed Mar 4, 2016
1 parent 7eb59f9 commit ec5d5c6
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,29 @@ I am a simple wrapper around mocha which sets various envirnment variables
I mainly exist so windows can run tests and set the NODE_ENV:/
*/

var path = require('path');
var spawn = require('child_process').spawn;

var testEnv = {};
for(var k in process.env){ testEnv[k] = process.env[k]; }
testEnv.NODE_ENV = 'test';

console.log('starting actionhero test suite with NODE_ENV=test');

var path = require('path');
var fork = require('child_process').fork;
var mocha = __dirname + path.sep + 'node_modules' + path.sep + '.bin' + path.sep + 'mocha';
var child = fork(mocha, ['test'], {
var execeutable;
if(process.platform === 'win32'){
execeutable = 'mocha.bash';
}else{
execeutable = 'mocha';
}

var mocha = __dirname + path.sep + 'node_modules' + path.sep + '.bin' + path.sep + execeutable;
var child = spawn(mocha, ['test'], {
cwd: __dirname,
env: testEnv
});

child.stdout.on('data', function(s){ process.stdout.write(String(s)); });
child.stderr.on('data', function(s){ process.stderr.write(String(s)); });

child.on('close', process.exit);

0 comments on commit ec5d5c6

Please sign in to comment.