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 25 matching lines...) Expand all Loading... |
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 * [`tags`](#tags) |
42 * [`add_tags`](#add_tags) | 42 * [`add_tags`](#add_tags) |
43 * [Configuring Platforms](#configuring-platforms) | 43 * [Configuring Platforms](#configuring-platforms) |
44 * [`on_os`](#on_os) | 44 * [`on_os`](#on_os) |
45 * [`on_platform`](#on_platform) | 45 * [`on_platform`](#on_platform) |
| 46 * [Configuration Presets](#configuration-presets) |
| 47 * [`presets`](#presets) |
| 48 * [`add_preset`](#add_preset) |
46 | 49 |
47 ## Test Configuration | 50 ## Test Configuration |
48 | 51 |
49 There are two major categories of configuration field: "test" and "runner". Test | 52 There are two major categories of configuration field: "test" and "runner". Test |
50 configuration controls how individual tests run, while | 53 configuration controls how individual tests run, while |
51 [runner configuration](#runner-configuration) controls the test runner as a | 54 [runner configuration](#runner-configuration) controls the test runner as a |
52 whole. Both types of fields may be used at the top level of a configuration | 55 whole. Both types of fields may be used at the top level of a configuration |
53 file. However, because different tests can have different test configuration, | 56 file. However, because different tests can have different test configuration, |
54 only test configuration fields may be used to [configure tags](#tags) or | 57 only test configuration fields may be used to [configure tags](#tags) or |
55 [platforms](#on_platform). | 58 [platforms](#on_platform). |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 resolved in. In practice, conflicting configuration is pretty unlikely and it's | 284 resolved in. In practice, conflicting configuration is pretty unlikely and it's |
282 easy to just explicitly specify what you want on the test itself. | 285 easy to just explicitly specify what you want on the test itself. |
283 | 286 |
284 This field counts as [test configuration](#test-configuration). | 287 This field counts as [test configuration](#test-configuration). |
285 | 288 |
286 ### `add_tags` | 289 ### `add_tags` |
287 | 290 |
288 This field adds additional tags. It's technically | 291 This field adds additional tags. It's technically |
289 [test configuration](#test-configuration), but it's usually used in more | 292 [test configuration](#test-configuration), but it's usually used in more |
290 specific contexts. For example, when included in a tag's configuration, it can | 293 specific contexts. For example, when included in a tag's configuration, it can |
291 be used to enable tag inheritance, where adding one tag implicitly adds other as | 294 be used to enable tag inheritance, where adding one tag implicitly adds another |
292 well. It takes a list of tag name strings. | 295 as well. It takes a list of tag name strings. |
293 | 296 |
294 ```yaml | 297 ```yaml |
295 tags: | 298 tags: |
296 # Any test that spawns a browser. | 299 # Any test that spawns a browser. |
297 browser: | 300 browser: |
298 timeout: 2x | 301 timeout: 2x |
299 | 302 |
300 # Tests that spawn specific browsers. These automatically get the browser tag | 303 # Tests that spawn specific browsers. These automatically get the browser tag |
301 # as well. | 304 # as well. |
302 chrome: {add_tags: [browser]} | 305 chrome: {add_tags: [browser]} |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 # Our code is kind of slow on Blink and WebKit. | 360 # Our code is kind of slow on Blink and WebKit. |
358 on_platform: | 361 on_platform: |
359 chrome || safari: {timeout: 2x} | 362 chrome || safari: {timeout: 2x} |
360 ``` | 363 ``` |
361 | 364 |
362 **Note**: operating system names that appear in `on_platform` refer to tests | 365 **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 | 366 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. | 367 when running on a particular operating system, use [`on_os`](#on_os) instead. |
365 | 368 |
366 This field counts as [test configuration](#test-configuration). | 369 This field counts as [test configuration](#test-configuration). |
| 370 |
| 371 ## Configuration Presets |
| 372 |
| 373 *Presets* are collections of configuration that can be explicitly selected on |
| 374 the command-line. They're useful for quickly selecting options that are |
| 375 frequently used together, for providing special configuration for continuous |
| 376 integration systems, and for defining more complex logic than can be expressed |
| 377 directly using command-line arguments. |
| 378 |
| 379 Presets can be selected on the command line using the `--preset` or `-P` flag. |
| 380 Any number of presets can be selected this way; if they conflict, the last one |
| 381 selected wins. Only presets that are defined in the configuration file may be |
| 382 selected. |
| 383 |
| 384 ### `presets` |
| 385 |
| 386 This field defines which presets are available to select. It takes a map from |
| 387 preset names to configuration maps that are applied when those presets are |
| 388 selected. These configuration maps are just like the top level of the |
| 389 configuration file, and allow any fields that may be used in the context where |
| 390 `presets` was used. |
| 391 |
| 392 ```yaml |
| 393 presets: |
| 394 # Use this when you need completely un-munged stack traces. |
| 395 debug: |
| 396 verbose_trace: false |
| 397 js_trace: true |
| 398 |
| 399 # Shortcut for running only browser tests. |
| 400 browser: |
| 401 paths: |
| 402 - test/runner/browser |
| 403 - test/runner/pub_serve_test.dart |
| 404 ``` |
| 405 |
| 406 The `presets` field counts as [test configuration](#test-configuration). It can |
| 407 be useful to use it in combination with other fields for advanced preset |
| 408 behavior. |
| 409 |
| 410 ```yaml |
| 411 tags: |
| 412 chrome: |
| 413 skip: "Our Chrome launcher is busted. See issue 1234." |
| 414 |
| 415 # Pass -P force to verify that the launcher is still busted. |
| 416 presets: {force: {skip: false}} |
| 417 ``` |
| 418 |
| 419 ### `add_presets` |
| 420 |
| 421 This field selects additional presets. It's technically |
| 422 [runner configuration](#runner-configuration), but it's usually used in more |
| 423 specific contexts. For example, when included in a preset's configuration, it |
| 424 can be used to enable preset inheritance, where selecting one preset implicitly |
| 425 selects another as well. It takes a list of preset name strings. |
| 426 |
| 427 ```yaml |
| 428 presets: |
| 429 # Shortcut for running only browser tests. |
| 430 browser: |
| 431 paths: [test/runner/browser] |
| 432 |
| 433 # Shortcut for running only Chrome tests. |
| 434 chrome: |
| 435 filename: "chrome_*_test.dart" |
| 436 add_presets: [browser] |
| 437 ``` |
OLD | NEW |