-
Notifications
You must be signed in to change notification settings - Fork 4
/
runAll.js
95 lines (84 loc) · 2.77 KB
/
runAll.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
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
88
89
90
91
92
93
94
95
var Mocha = require('mocha'),
fs = require('fs'),
path = require('path'),
async = require('async');
var cp = require('child_process');
// Scan the 'test' directory for all JS files
var testDir = 'test';
var allTests = fs.readdirSync(testDir).filter(function(file){
// Only keep the .js files
return file.substr(-3) === '.js';
});
var studentTests = {
'scott-smith': [ 'motd' ],
'danny-wittenauer': [ 'motd', 'users', 'items', 'inventory' ],
'joel-shook': [ 'motd' ],
'mark-lauzon': [ 'motd', 'items' ],
'j-heruty': [ 'motd', 'items' ],
'andrew-taylor': [ 'motd', 'items' ],
'joshua-shlemmer': [ 'motd', 'items' ],
'j-fisher': [ 'motd', 'items' ],
'nlouks': [ 'motd' ],
'chad-george': [ 'motd' ],
'ismail-obaid': [ 'motd' ],
'j-peter': [ 'motd' ],
'chase-hutchens': [ 'motd' ],
'atownsend': [ 'motd' ],
'j-shirley': [ 'motd' ],
'greg-walls': [ 'motd' ],
'eric-li': [ 'motd' ],
'saerom-sim': [ 'motd' ],
'kali-b': [ 'motd' ],
'yoonyoung-k': [ 'motd' ],
'c-eichner': [ 'motd' ],
'euntaek-park': [ 'motd' ],
'ryan-davidson': [ 'motd' ],
'dylan-petterson': [ 'motd' ],
'r-pannkuk': [ 'motd' ],
'neil-frankwick': [ 'motd' ],
'christopher-j': [ 'motd' ],
'blake-richardson': [ 'motd' ],
'michael-rosen': [ 'motd' ],
'craig-steyn': [ 'motd' ],
'river-riddle': [ 'motd' ],
'c-john': [ 'motd' ],
'd-jacobsen': [ 'motd' ],
'daniel-oliveira': [ 'motd' ],
'uong-j': [ 'motd' ],
'tristan-schneider': [ 'motd' ],
'hsihung-shih': [ 'motd' ]
};
var studentTestResults = {
};
// For each student, synchronously run all the appropriate tests
async.forEachOfSeries(studentTests, function(testsToRun, student, andThen) {
var url = 'http';
if (testsToRun.indexOf('ssl') >= 0)
url += 's';
url += '://';
url += student.replace(".", "-");
url += '.cs261.net/api/v1';
process.env.TEST_ROOT_URL = url;
process.env.TEST_ENDPOINTS = testsToRun;
process.env.TEST_ADMIN = 'TestAdmin';
process.env.TEST_ADMIN_PASSWORD = 'PixarGoodGhibliBETTER';
var tested = { };
studentTestResults[student] = tested;
var cmd = 'node runOne.js ' + student + ' ' + testsToRun.join(',');
console.log(cmd);
cp.exec(cmd, function(err, stdout, stderr) {
if (!err) {
tested.stdout = stdout;
tested.stderr = stderr;
}
andThen();
});
}, function(err) {
for (var student in studentTestResults) {
console.log('**** ' + student);
if (studentTestResults[student].stdout) {
console.log(studentTestResults[student].stdout);
}
console.log('**********');
}
});