Skip to content

Instantly share code, notes, and snippets.

@polotek
Created January 6, 2012 08:04
Show Gist options
  • Save polotek/1569612 to your computer and use it in GitHub Desktop.
Save polotek/1569612 to your computer and use it in GitHub Desktop.
// FAILS=0
// for i in tests/test-*.js; do
// echo $i
// node $i || let FAILS++
// done
// exit $FAILS
var fs = require('fs')
, glob = require('glob')
, $p = require(__dirname + '/..');
glob("tests/test-*.js")
.forEach(function (path) {
chain = chain ? chain.then('node', path) : $p('node', path);
chain.on('exit', function(code) {
if(code) {
fails++;
}
}).out();
});
// chain now has a pipe of all test files ready to be run sequentially
chain.on('exit', function() {
if(fails) {
console.error('\n' + fails + ' failed');
process.exit(fails);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment