diff --git a/tools/commands.js b/tools/commands.js index 6eff8b91aa..d787019208 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -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; } } diff --git a/tools/help.txt b/tools/help.txt index c8fd32c737..0c9a492294 100644 --- a/tools/help.txt +++ b/tools/help.txt @@ -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 diff --git a/tools/selftest.js b/tools/selftest.js index bfabb4db87..9c91fee132 100644 --- a/tools/selftest.js +++ b/tools/selftest.js @@ -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) {