OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:io'; | 5 import 'dart:io'; |
6 import 'dart:math' as math; | 6 import 'dart:math' as math; |
7 | 7 |
8 import 'package:args/args.dart'; | 8 import 'package:args/args.dart'; |
9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 var allPlatforms = TestPlatform.all.toList(); | 29 var allPlatforms = TestPlatform.all.toList(); |
30 if (!Platform.isMacOS) allPlatforms.remove(TestPlatform.safari); | 30 if (!Platform.isMacOS) allPlatforms.remove(TestPlatform.safari); |
31 if (!Platform.isWindows) allPlatforms.remove(TestPlatform.internetExplorer); | 31 if (!Platform.isWindows) allPlatforms.remove(TestPlatform.internetExplorer); |
32 | 32 |
33 parser.addFlag("help", abbr: "h", negatable: false, | 33 parser.addFlag("help", abbr: "h", negatable: false, |
34 help: "Shows this usage information."); | 34 help: "Shows this usage information."); |
35 parser.addFlag("version", negatable: false, | 35 parser.addFlag("version", negatable: false, |
36 help: "Shows the package's version."); | 36 help: "Shows the package's version."); |
37 parser.addOption("package-root", hide: true); | 37 parser.addOption("package-root", hide: true); |
| 38 |
| 39 parser.addSeparator("======== Selecting Tests"); |
38 parser.addOption("name", | 40 parser.addOption("name", |
39 abbr: 'n', | 41 abbr: 'n', |
40 help: 'A substring of the name of the test to run.\n' | 42 help: 'A substring of the name of the test to run.\n' |
41 'Regular expression syntax is supported.'); | 43 'Regular expression syntax is supported.'); |
42 parser.addOption("plain-name", | 44 parser.addOption("plain-name", |
43 abbr: 'N', | 45 abbr: 'N', |
44 help: 'A plain-text substring of the name of the test to run.'); | 46 help: 'A plain-text substring of the name of the test to run.'); |
45 // TODO(nweiz): Support the full platform-selector syntax for choosing which | 47 // TODO(nweiz): Support the full platform-selector syntax for choosing which |
46 // tags to run. In the shorter term, disallow non-"identifier" tags. | 48 // tags to run. In the shorter term, disallow non-"identifier" tags. |
47 parser.addOption("tags", | 49 parser.addOption("tags", |
48 abbr: 't', | 50 abbr: 't', |
49 help: 'Run only tests with all of the specified tags.', | 51 help: 'Run only tests with all of the specified tags.', |
50 allowMultiple: true); | 52 allowMultiple: true); |
51 parser.addOption("tag", hide: true, allowMultiple: true); | 53 parser.addOption("tag", hide: true, allowMultiple: true); |
52 parser.addOption("exclude-tags", | 54 parser.addOption("exclude-tags", |
53 abbr: 'x', | 55 abbr: 'x', |
54 help: "Don't run tests with any of the specified tags.", | 56 help: "Don't run tests with any of the specified tags.", |
55 allowMultiple: true); | 57 allowMultiple: true); |
56 parser.addOption("exclude-tag", hide: true, allowMultiple: true); | 58 parser.addOption("exclude-tag", hide: true, allowMultiple: true); |
| 59 |
| 60 parser.addSeparator("======== Running Tests"); |
57 parser.addOption("platform", | 61 parser.addOption("platform", |
58 abbr: 'p', | 62 abbr: 'p', |
59 help: 'The platform(s) on which to run the tests.', | 63 help: 'The platform(s) on which to run the tests.', |
60 allowed: allPlatforms.map((platform) => platform.identifier).toList(), | 64 allowed: allPlatforms.map((platform) => platform.identifier).toList(), |
61 defaultsTo: 'vm', | 65 defaultsTo: 'vm', |
62 allowMultiple: true); | 66 allowMultiple: true); |
63 parser.addOption("concurrency", | 67 parser.addOption("concurrency", |
64 abbr: 'j', | 68 abbr: 'j', |
65 help: 'The number of concurrent test suites run.\n' | 69 help: 'The number of concurrent test suites run.\n' |
66 '(defaults to $_defaultConcurrency)', | 70 '(defaults to $_defaultConcurrency)', |
67 valueHelp: 'threads'); | 71 valueHelp: 'threads'); |
68 parser.addOption("pub-serve", | 72 parser.addOption("pub-serve", |
69 help: 'The port of a pub serve instance serving "test/".', | 73 help: 'The port of a pub serve instance serving "test/".', |
70 valueHelp: 'port'); | 74 valueHelp: 'port'); |
71 parser.addFlag("pause-after-load", | 75 parser.addFlag("pause-after-load", |
72 help: 'Pauses for debugging before any tests execute.\n' | 76 help: 'Pauses for debugging before any tests execute.\n' |
73 'Implies --concurrency=1.\n' | 77 'Implies --concurrency=1.\n' |
74 'Currently only supported for browser tests.', | 78 'Currently only supported for browser tests.', |
75 negatable: false); | 79 negatable: false); |
| 80 |
| 81 parser.addSeparator("======== Output"); |
76 parser.addOption("reporter", | 82 parser.addOption("reporter", |
77 abbr: 'r', | 83 abbr: 'r', |
78 help: 'The runner used to print test results.', | 84 help: 'The runner used to print test results.', |
79 allowed: ['compact', 'expanded', 'json'], | 85 allowed: ['compact', 'expanded', 'json'], |
80 defaultsTo: Platform.isWindows ? 'expanded' : 'compact', | 86 defaultsTo: Platform.isWindows ? 'expanded' : 'compact', |
81 allowedHelp: { | 87 allowedHelp: { |
82 'compact': 'A single line, updated continuously.', | 88 'compact': 'A single line, updated continuously.', |
83 'expanded': 'A separate line for each update.', | 89 'expanded': 'A separate line for each update.', |
84 'json': 'A machine-readable format (see https://goo.gl/0HRhdZ).' | 90 'json': 'A machine-readable format (see https://goo.gl/0HRhdZ).' |
85 }); | 91 }); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 : Uri.parse("http://localhost:$pubServePort"), | 247 : Uri.parse("http://localhost:$pubServePort"), |
242 concurrency = pauseAfterLoad | 248 concurrency = pauseAfterLoad |
243 ? 1 | 249 ? 1 |
244 : (concurrency == null ? _defaultConcurrency : concurrency), | 250 : (concurrency == null ? _defaultConcurrency : concurrency), |
245 platforms = platforms == null ? [TestPlatform.vm] : platforms.toList(), | 251 platforms = platforms == null ? [TestPlatform.vm] : platforms.toList(), |
246 paths = paths == null ? ["test"] : paths.toList(), | 252 paths = paths == null ? ["test"] : paths.toList(), |
247 explicitPaths = paths != null, | 253 explicitPaths = paths != null, |
248 this.tags = tags, | 254 this.tags = tags, |
249 this.excludeTags = excludeTags; | 255 this.excludeTags = excludeTags; |
250 } | 256 } |
OLD | NEW |