shelljs/scripts/run-tests.js
Marcus Stade 829bdbc785 Improved tests and implementation.
Plenty of errors surfaced with better test coverage. Aside from fixing
the broken implementations, this also prompted me to fully implement
the dirs command.

Also changed the run-tests script to always set cwd to the test folder,
so that tests that change cwd don't affect others (ehum, that'd be
mine.)

More tests to follow.
2012-12-29 03:43:23 +01:00

27 lines
677 B
JavaScript
Executable File

#!/usr/bin/env node
require('../global');
var path = require('path');
var failed = false;
cd(__dirname + '/../test');
ls('*.js').forEach(function(file) {
echo('Running test:', file);
if (exec('node ' + file, { cwd: path.resolve(__dirname, '/../test') }).code !== 123) { // 123 avoids false positives (e.g. premature exit)
failed = true;
echo('*** TEST FAILED! (missing exit code "123")');
}
});
if (failed) {
echo();
echo('*******************************************************');
echo('WARNING: Some tests did not pass!');
echo('*******************************************************');
exit(1);
} else {
echo();
echo('All tests passed.');
}