In self-test, make '--tests' into an argument and document it.

This commit is contained in:
Geoff Schmidt
2014-02-18 14:18:07 -08:00
parent dd2b5ce729
commit 653045ffec
3 changed files with 12 additions and 7 deletions

View File

@@ -1256,12 +1256,13 @@ main.registerCommand({
main.registerCommand({
name: 'self-test',
minArgs: 0,
maxArgs: 1,
options: {
changed: { type: Boolean },
'force-online': { type: Boolean },
slow: { type: Boolean },
history: { type: Number },
tests: { type: String }
},
hidden: true
}, function (options) {
@@ -1279,13 +1280,13 @@ main.registerCommand({
}
var testRegexp = undefined;
if (options.tests) {
if (options.args.length) {
try {
testRegexp = new RegExp(options.tests);
testRegexp = new RegExp(options.args[0]);
} catch (e) {
if (!(e instanceof SyntaxError))
throw e;
process.stderr.write("Bad regular expression: " + options.tests + "\n");
process.stderr.write("Bad regular expression: " + options.args[0] + "\n");
return 1;
}
}

View File

@@ -311,10 +311,14 @@ system for building standalone command-line programs with Meteor.
>>> self-test
Run tests of the 'meteor' tool.
Usage: meteor self-test [--changed] [--slow] [--force-online] [--history n]
Usage: meteor self-test [pattern] [--changed] [--slow]
[--force-online] [--history n]
Runs internal tests. Exits with status 0 on success.
If 'pattern' is provided, it should be a regular expression. Only
tests that match the regular expression will be run.
Pass --changed to run only tests that have changed since they last
passed. This uses a really rough heuristic: A test has changed iff
there has been any change to the file in the 'selftests' subdirectory

View File

@@ -976,7 +976,7 @@ var tagDescriptions = {
// these last two are not actually test tags; they reflect the use of
// --changed and --tests
unchanged: 'unchanged since last pass',
misnamed: "don't match --tests argument"
'non-matching': "don't match specified pattern"
};
// options: onlyChanged, offline, includeSlowTests, historyLines, testRegexp
@@ -1015,7 +1015,7 @@ var runTests = function (options) {
tests = _.filter(tests, function (test) {
return options.testRegexp.test(test.name);
});
skipCounts.misnamed = lengthBeforeTestRegexp - tests.length;
skipCounts['non-matching'] = lengthBeforeTestRegexp - tests.length;
}
if (options.onlyChanged) {