OLD | NEW |
1 Each package may include a configuration file that applies to the package as a | 1 Each package may include a configuration file that applies to the package as a |
2 whole. This file can be used to provide custom defaults for various options, to | 2 whole. This file can be used to provide custom defaults for various options, to |
3 define configuration for multiple files, and more. | 3 define configuration for multiple files, and more. |
4 | 4 |
5 The file is named `dart_test.yaml` and lives at the root of the package, next to | 5 The file is named `dart_test.yaml` and lives at the root of the package, next to |
6 the package's pubspec. Like the pubspec, it's a [YAML][] file. Here's an | 6 the package's pubspec. Like the pubspec, it's a [YAML][] file. Here's an |
7 example: | 7 example: |
8 | 8 |
9 [YAML]: http://yaml.org/ | 9 [YAML]: http://yaml.org/ |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 * [`skip`](#skip) | 31 * [`skip`](#skip) |
32 * [`test_on`](#test_on) | 32 * [`test_on`](#test_on) |
33 * [Runner Configuration](#runner-configuration) | 33 * [Runner Configuration](#runner-configuration) |
34 * [`paths`](#paths) | 34 * [`paths`](#paths) |
35 * [`filename`](#filename) | 35 * [`filename`](#filename) |
36 * [`platforms`](#platforms) | 36 * [`platforms`](#platforms) |
37 * [`concurrency`](#concurrency) | 37 * [`concurrency`](#concurrency) |
38 * [`pub_serve`](#pub_serve) | 38 * [`pub_serve`](#pub_serve) |
39 * [`reporter`](#reporter) | 39 * [`reporter`](#reporter) |
40 * [Configuring Tags](#configuring-tags) | 40 * [Configuring Tags](#configuring-tags) |
| 41 * [`tags`](#tags) |
41 * [`add_tags`](#add_tags) | 42 * [`add_tags`](#add_tags) |
| 43 * [Configuring Platforms](#configuring-platforms) |
| 44 * [`on_os`](#on_os) |
| 45 * [`on_platform`](#on_platform) |
42 | 46 |
43 ## Test Configuration | 47 ## Test Configuration |
44 | 48 |
45 There are two major categories of configuration field: "test" and "runner". Test | 49 There are two major categories of configuration field: "test" and "runner". Test |
46 configuration controls how individual tests run, while | 50 configuration controls how individual tests run, while |
47 [runner configuration](#runner-configuration) controls the test runner as a | 51 [runner configuration](#runner-configuration) controls the test runner as a |
48 whole. Both types of fields may be used at the top level of a configuration | 52 whole. Both types of fields may be used at the top level of a configuration |
49 file. However, because different tests can have different test configuration, | 53 file. However, because different tests can have different test configuration, |
50 only test configuration fields may be used to | 54 only test configuration fields may be used to [configure tags](#tags) or |
51 [configure tags](#configuring-tags). | 55 [platforms](#on_platform). |
52 | 56 |
53 ### `timeout` | 57 ### `timeout` |
54 | 58 |
55 This field indicates how much time the test runner should allow a test to remain | 59 This field indicates how much time the test runner should allow a test to remain |
56 inactive before it considers that test to have failed. It has three possible | 60 inactive before it considers that test to have failed. It has three possible |
57 formats: | 61 formats: |
58 | 62 |
59 * The string "none" indicates that tests should never time out. | 63 * The string "none" indicates that tests should never time out. |
60 | 64 |
61 * A number followed by a unit abbreviation indicates an exact time. For example, | 65 * A number followed by a unit abbreviation indicates an exact time. For example, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 109 |
106 ```yaml | 110 ```yaml |
107 tags: | 111 tags: |
108 chrome: | 112 chrome: |
109 skip: "Our Chrome launcher is busted. See issue 1234." | 113 skip: "Our Chrome launcher is busted. See issue 1234." |
110 ``` | 114 ``` |
111 | 115 |
112 ### `test_on` | 116 ### `test_on` |
113 | 117 |
114 This field declares which platforms a test supports. It takes a | 118 This field declares which platforms a test supports. It takes a |
115 [platform selector][] and only allows tests to run on platforms that match the | 119 [platform selector][platform selectors] and only allows tests to run on |
116 selector. It's often used with [specific tags](#configuring-tags) to ensure that | 120 platforms that match the selector. It's often used with |
117 certain features will only be tested on supported platforms. | 121 [specific tags](#configuring-tags) to ensure that certain features will only be |
| 122 tested on supported platforms. |
118 | 123 |
119 [platform selector]: https://github.com/dart-lang/test/blob/master/README.md#pla
tform-selectors | 124 [platform selectors]: https://github.com/dart-lang/test/blob/master/README.md#pl
atform-selectors |
120 | 125 |
121 ```yaml | 126 ```yaml |
122 tags: | 127 tags: |
123 # Internet Explorer doesn't support promises yet. | 128 # Internet Explorer doesn't support promises yet. |
124 promises: {test_on: "browser && !ie"} | 129 promises: {test_on: "browser && !ie"} |
125 ``` | 130 ``` |
126 | 131 |
127 The field can also be used at the top level of the configuration file to | 132 The field can also be used at the top level of the configuration file to |
128 indicate that the entire package only supports a particular platform. If someone | 133 indicate that the entire package only supports a particular platform. If someone |
129 tries to run the tests on an unsupported platform, the runner will print a | 134 tries to run the tests on an unsupported platform, the runner will print a |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 This field indicates the default reporter to use. It may be set to "compact", | 221 This field indicates the default reporter to use. It may be set to "compact", |
217 "expanded", or "json" (although why anyone would want to default to JSON is | 222 "expanded", or "json" (although why anyone would want to default to JSON is |
218 beyond me). It defaults to "expanded" on Windows and "compact" everywhere else. | 223 beyond me). It defaults to "expanded" on Windows and "compact" everywhere else. |
219 | 224 |
220 ```yaml | 225 ```yaml |
221 reporter: expanded | 226 reporter: expanded |
222 ``` | 227 ``` |
223 | 228 |
224 ## Configuring Tags | 229 ## Configuring Tags |
225 | 230 |
| 231 ### `tags` |
| 232 |
226 The `tag` field can be used to apply [test configuration](#test-configuration) | 233 The `tag` field can be used to apply [test configuration](#test-configuration) |
227 to all tests [with a given tag][tagging tests] or set of tags. It takes a map | 234 to all tests [with a given tag][tagging tests] or set of tags. It takes a map |
228 from tag selectors to configuration maps. These configuration maps are just like | 235 from tag selectors to configuration maps. These configuration maps are just like |
229 the top level of the configuration file, except that they may not contain | 236 the top level of the configuration file, except that they may not contain |
230 [runner configuration](#runner-configuration). | 237 [runner configuration](#runner-configuration). |
231 | 238 |
232 [tagging tests]: https://github.com/dart-lang/test/blob/master/README.md#tagging
-tests | 239 [tagging tests]: https://github.com/dart-lang/test/blob/master/README.md#tagging
-tests |
233 | 240 |
234 ```yaml | 241 ```yaml |
235 tags: | 242 tags: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 Tag configuration is applied at whatever level the tag appears—so if a group is | 274 Tag configuration is applied at whatever level the tag appears—so if a group is |
268 tagged as `integration`, its timeout will take precedence over the suite's | 275 tagged as `integration`, its timeout will take precedence over the suite's |
269 timeout but not any tests'. If the group itself had a timeout declared, the | 276 timeout but not any tests'. If the group itself had a timeout declared, the |
270 group's explicit timeout would take precedence over the tag. | 277 group's explicit timeout would take precedence over the tag. |
271 | 278 |
272 If multiple tags appear at the same level, and they have conflicting | 279 If multiple tags appear at the same level, and they have conflicting |
273 configurations, the test runner *does not guarantee* what order they'll be | 280 configurations, the test runner *does not guarantee* what order they'll be |
274 resolved in. In practice, conflicting configuration is pretty unlikely and it's | 281 resolved in. In practice, conflicting configuration is pretty unlikely and it's |
275 easy to just explicitly specify what you want on the test itself. | 282 easy to just explicitly specify what you want on the test itself. |
276 | 283 |
| 284 This field counts as [test configuration](#test-configuration). |
| 285 |
277 ### `add_tags` | 286 ### `add_tags` |
278 | 287 |
279 This field adds additional tags. It's technically | 288 This field adds additional tags. It's technically |
280 [test configuration](#test-configuration), but it's usually used in more | 289 [test configuration](#test-configuration), but it's usually used in more |
281 specific contexts. For example, when included in a tag's configuration, it can | 290 specific contexts. For example, when included in a tag's configuration, it can |
282 be used to enable tag inheritance, where adding one tag implicitly adds other as | 291 be used to enable tag inheritance, where adding one tag implicitly adds other as |
283 well. It takes a list of tag name strings. | 292 well. It takes a list of tag name strings. |
284 | 293 |
285 ```yaml | 294 ```yaml |
286 tags: | 295 tags: |
287 # Any test that spawns a browser. | 296 # Any test that spawns a browser. |
288 browser: | 297 browser: |
289 timeout: 2x | 298 timeout: 2x |
290 | 299 |
291 # Tests that spawn specific browsers. These automatically get the browser tag | 300 # Tests that spawn specific browsers. These automatically get the browser tag |
292 # as well. | 301 # as well. |
293 chrome: {add_tags: [browser]} | 302 chrome: {add_tags: [browser]} |
294 firefox: {add_tags: [browser]} | 303 firefox: {add_tags: [browser]} |
295 safari: {add_tags: [browser]} | 304 safari: {add_tags: [browser]} |
296 ie: {add_tags: [browser]} | 305 ie: {add_tags: [browser]} |
297 ``` | 306 ``` |
| 307 |
| 308 ## Configuring Platforms |
| 309 |
| 310 There are two different kinds of platform configuration. |
| 311 [Operating system configuration](#on_os) cares about the operating system on |
| 312 which test runner is running. It sets global configuration for the runner on |
| 313 particular OSes. [Test platform configuration](#on_platform), on the other hand, |
| 314 cares about the platform the *test* is running on (like the |
| 315 [`@OnPlatform` annotation][@OnPlatform]). It sets configuration for particular |
| 316 tests that are running on matching platforms. |
| 317 |
| 318 [@OnPlatform]: https://github.com/dart-lang/test/blob/master/README.md#platform-
specific-configuration |
| 319 |
| 320 ### `on_os` |
| 321 |
| 322 This field applies configuration when specific operating systems are being used. |
| 323 It takes a map from operating system identifiers (the same ones that are used in |
| 324 [platform selectors][]) to configuration maps that are applied on those |
| 325 operating systems. These configuration maps are just like the top level of the |
| 326 configuration file, and allow any fields that may be used in the context where |
| 327 `on_os` was used. |
| 328 |
| 329 ```yaml |
| 330 on_os: |
| 331 windows: |
| 332 # Both of these are the defaults anyway, but let's be explicit about it. |
| 333 color: false |
| 334 runner: expanded |
| 335 |
| 336 # My Windows machine is real slow. |
| 337 timeout: 2x |
| 338 |
| 339 # My Linux machine has SO MUCH RAM. |
| 340 linux: |
| 341 concurrency: 500 |
| 342 ``` |
| 343 |
| 344 This field counts as [test configuration](#test-configuration). If it's used in |
| 345 a context that only allows test configuration, it may only contain test |
| 346 configuration. |
| 347 |
| 348 ### `on_platform` |
| 349 |
| 350 This field applies configuration to tests that are run on specific platforms. It |
| 351 takes a map from [platform selectors][] to configuration maps that are applied |
| 352 to tests run on those platforms. These configuration maps are just like the top |
| 353 level of the configuration file, except that they may not contain |
| 354 [runner configuration](#runner-configuration). |
| 355 |
| 356 ```yaml |
| 357 # Our code is kind of slow on Blink and WebKit. |
| 358 on_platform: |
| 359 chrome || safari: {timeout: 2x} |
| 360 ``` |
| 361 |
| 362 **Note**: operating system names that appear in `on_platform` refer to tests |
| 363 that are run on the Dart VM under that operating system. To configure all tests |
| 364 when running on a particular operating system, use [`on_os`](#on_os) instead. |
| 365 |
| 366 This field counts as [test configuration](#test-configuration). |
OLD | NEW |