forked from actionhero/actionhero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
executable file
·32 lines (25 loc) · 898 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env node
/*
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 execeutable;
if(process.platform === 'win32'){
execeutable = 'mocha.cmd';
}else{
execeutable = 'mocha';
}
var mocha = __dirname + path.sep + 'node_modules' + path.sep + '.bin' + path.sep + execeutable;
var child = spawn(mocha, ['test', '--reporter', 'dot'], {
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);