-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.js
More file actions
87 lines (67 loc) · 1.9 KB
/
run_tests.js
File metadata and controls
87 lines (67 loc) · 1.9 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//original script http://goo.gl/YVwl3u
//sound from https://www.freesound.org/people/Puniho/sounds/115560/
var fs = require("fs");
//var groove = require('groove');
function tryAgain() {
/*var playlist = groove.createPlaylist();
var player = groove.createPlayer();
groove.open("test_unit/try-again.mp3", function(err, file) {
if (err) throw err;
playlist.insert(file);
player.attach(playlist, function(err) {
});
playlist.play();
player.on('nowplaying', function() {
var current = player.position();
if (!current.item) {
playlist.clear();
file.close(function(){});
}
});
});*/
}
var run = false;
process.argv.forEach(function (val, index, array) {
if (index == 2 && val == "-nodemon") {
run = true;
}
});
if (run) {
//setup nodemon
console.log("-------------------------------");
console.log("Launching nodemon to wrap tests");
console.log("-------------------------------");
var nodemon = require('nodemon');
nodemon("run_tests.js").on('crash', function () {
tryAgain();
});
return;
}
//setup logging on console
var requirejs = require('requirejs');
requirejs.config({
nodeRequire: require
});
requirejs(["./lib/log/LoggerManager","./lib/log/console/LoggerProvider"],
function(LoggerManager,LoggerProvider) {
LoggerManager.setLoggerProvider(LoggerProvider);
});
var diveSync = require("diveSync");
var nodeUnit = require('nodeunit');
//read the list of folders under test
var directoriesToTest = ['test_unit'];
diveSync(directoriesToTest[0], {directories:true}, function(err, file) {
if (fs.lstatSync(file).isDirectory()) {
directoriesToTest.push(file);
}
});
//start the tests
nodeUnit.reporters.default.run(directoriesToTest,null,function(err) {
if (err) {
tryAgain();
}
});
process.on('uncaughtException', function (err) {
console.log('Uncaught exception: ' + err.stack);
tryAgain();
});