forked from TimelordUK/node-sqlserver-v8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtest.js
55 lines (42 loc) · 1.09 KB
/
runtest.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var Mocha = require('mocha');
var demo = require('./demo-support');
var sql = require('msnodesqlv8');
runTest();
function runTest() {
var argv = require('minimist')(process.argv.slice(2));
console.log(argv);
var toRun;
if (argv.hasOwnProperty('t')) {
toRun = argv['t'];
}
if (!Array.isArray(toRun)) {
toRun = [toRun];
}
run(toRun, function(e) {
console.log(e);
process.exit(e);
});
function run(files, done) {
var mocha = new Mocha(
{
ui : 'tdd'
}
);
mocha.suite.on('pre-require', function(g, b, c) {
g.native_sql = sql;
});
mocha.suite.on('require', function(a, b, c) {
});
files.forEach(function(f) {
mocha.addFile('test/' + f);
});
mocha.run(function (failures) {
process.on('uncaughtException', function (err) {
console.log(err);
});
process.on('exit', function () {
done(failures);
});
});
}
}