in jones-test/lib/Driver.js [262:412]
Driver.prototype.setCommandLineFlags = function() {
var opts = this.flagHandler,
driver = this;
opts.addOption(new CommandLine.Option(
"-h", "--help", "print this message",
function() {
driver.abortAndExit = true;
return 0;
}
));
opts.addOption(new CommandLine.Option(
"-l", "--list", "just list test suites",
function() {
driver.listSuitesAndExit = true;
return 0;
}
));
opts.addOption(new CommandLine.Option(
"-d", "--debug", "enable debug output",
function() {
unified_debug.level_debug();
unified_debug.on();
return 0;
}
));
opts.addOption(new CommandLine.Option(
null, "--detail", "enable detailed debug output",
function() {
unified_debug.level_detail();
unified_debug.on();
return 0;
}
));
opts.addOption(new CommandLine.Option(
"-df=<sourcefile>", null, "enable all debug output from <sourcefile>",
function(thisArg) {
unified_debug.on();
unified_debug.set_file_level(thisArg, 5);
return 1;
}
));
opts.addOption(new CommandLine.Option(
"-t", "--trace", "print stack trace from failing tests",
function() {
driver.result.listener.printStackTraces = true;
return 0;
}
));
opts.addOption(new CommandLine.Option(
null, "--skip-smoke", "do not run SmokeTest",
function() {
driver.skipSmokeTest = true;
return 0;
}
));
opts.addOption(new CommandLine.Option(
null, "--skip-clear", "do not run ClearSmokeTest",
function() {
driver.skipClearSmokeTest = true;
return 0;
}
));
// --timeout takes a value in milliseconds
opts.addOption(new CommandLine.Option(
null, "--timeout <msec>", "set timeout in msec.",
function(thisArg) {
if(thisArg) {
driver.timeoutMillis = thisArg;
return 1;
}
return -1; // timeout value is required
}
));
// --failed and --quiet both imply 10 sec. timeout:
opts.addOption(new CommandLine.Option(
"-q", "--quiet", "do not print individual test results",
function() {
driver.result.listener = new Listener.QuietListener();
driver.timeoutMillis = 10000;
return 0;
}
));
opts.addOption(new CommandLine.Option(
"-f", "--failed", "suppress passed tests, print failures only",
function() {
driver.result.listener = new Listener.FailOnlyListener();
driver.timeoutMillis = 10000;
return 0;
}
));
opts.addOption(new CommandLine.Option(
null, "--suite <suite>", "only run the named suite",
function(thisArg) {
return driver.setSuitesToRun(thisArg);
}
));
opts.addOption(new CommandLine.Option(
null, "--suites <suite,suite,...>", "only run the named suites",
function(thisArg) {
return driver.setSuitesToRun(thisArg);
}
));
opts.addOption(new CommandLine.Option(
null, "--test <testFile>", "only run the named test file",
function(thisArg) {
var suite;
if(thisArg) {
if(! thisArg.match(/\.js$/)) {
if(thisArg.match(/Test$/)) {
thisArg += ".js";
} else {
thisArg += "Test.js";
}
}
driver.fileToRun = path.basename(thisArg);
suite = path.dirname(thisArg);
if(suite) {
driver.suitesToRun = [ suite ];
}
return 1;
}
return -1; // argument is required
}
));
opts.addOption(new CommandLine.Option(
null, "--case <n,m,...>","only run test cases numbered n, m, etc. in <testFile>\n",
function(thisArg) {
if(thisArg) {
driver.testInFile = thisArg;
return 1;
}
return -1; // test number is required
}
));
};