-
Notifications
You must be signed in to change notification settings - Fork 0
/
alltests.js
33 lines (27 loc) · 908 Bytes
/
alltests.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
if (module == require.main) {
var spawn = require('child_process').spawn;
var path = require('path');
var assert = require('assert');
var tests = {
'test-fail.js': 1,
'test-multinstance.js': 0,
'test-namedtest.js': 0,
'test-simple.js': 0,
'test-stacktrace': (process.version.slice(0, 5) === 'v0.10') ? 8 : 1
};
for (var test in tests) {
var expectedRetCode = tests[test];
var testProcess = spawn(process.execPath, [path.join(__dirname, test)]);
testProcess.stdout.on('data', function (data) {
process.stdout.write(data.toString());
});
testProcess.stderr.on('data', function (data) {
process.stderr.write(data.toString());
});
(function (expectedRetCode) {
testProcess.on('exit', function (code, signal) {
assert.equal(expectedRetCode, code);
});
})(expectedRetCode);
}
}