2010-01-17 09:08:28 +08:00
|
|
|
require.paths.unshift("./spec/lib", "./lib");
|
|
|
|
require("jspec");
|
|
|
|
|
2010-02-22 17:09:56 +08:00
|
|
|
var sys = require("sys"), fs = require("fs");
|
2010-01-17 09:08:28 +08:00
|
|
|
|
|
|
|
quit = process.exit
|
|
|
|
print = sys.puts
|
|
|
|
|
|
|
|
readFile = function(path) {
|
|
|
|
var result;
|
|
|
|
try {
|
2010-08-11 11:36:51 +08:00
|
|
|
result = fs.readFileSync(path, "utf8");
|
2010-01-17 09:08:28 +08:00
|
|
|
} catch (e) {
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
var specsFound = false;
|
|
|
|
|
|
|
|
if (process.ARGV[2]) {
|
|
|
|
specsFound = true;
|
|
|
|
JSpec.exec('spec/spec.' + process.ARGV[2] + '.js');
|
|
|
|
} else {
|
2010-02-22 17:09:56 +08:00
|
|
|
var files = fs.readdirSync('spec/');
|
2010-01-17 09:08:28 +08:00
|
|
|
files.filter(
|
|
|
|
function (file) {
|
|
|
|
return file.indexOf('spec.') === 0;
|
|
|
|
}
|
|
|
|
).forEach(
|
|
|
|
function(file) {
|
|
|
|
specsFound = true;
|
|
|
|
JSpec.exec('spec/'+file);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (specsFound) {
|
2010-08-11 11:36:51 +08:00
|
|
|
JSpec.run({ reporter: JSpec.reporters.Terminal, failuresOnly: false });
|
2010-01-17 09:08:28 +08:00
|
|
|
JSpec.report();
|
|
|
|
} else {
|
|
|
|
print("No tests to run. This makes me sad.");
|
|
|
|
}
|
|
|
|
|