Skip to content

Commit

Permalink
count test passes and exit process with exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
leetreveil committed Jul 8, 2012
1 parent 235fffb commit 6f2e87d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/alltests.js
Expand Up @@ -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)]);
Expand All @@ -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.