Permalink
Browse files

count test passes and exit process with exit code

  • Loading branch information...
1 parent 235fffb commit 6f2e87d283ace38eabc968bbd1973ddefffba2b6 @leetreveil committed Jul 8, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 test/alltests.js
View
12 test/alltests.js
@@ -10,7 +10,9 @@ if (module == require.main) {
'test-flac.js', 'test-utf16bom-encoding.js',
'test-ogg-multipagemetadatabug.js',
'test-apev2-monkeysaudio.js'];
-
+
+ var passedTests = 0;
+
for (var i=0; i < tests.length; i++) {
var test = tests[i];
var testProcess = spawn(process.execPath, [path.join(__dirname, test)]);
@@ -21,6 +23,14 @@ if (module == require.main) {
testProcess.stderr.on('data', function(data) {
process.stderr.write(data.toString());
+ });
+
+ testProcess.on('exit', function () {
+ passedTests++;
});
}
+
+ process.once('exit', function () {
+ process.exit((passedTests === tests.length) ? 0 : 1);
+ });
}

0 comments on commit 6f2e87d

Please sign in to comment.