| 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 | 6 |
| 7 import 'package:boolean_selector/boolean_selector.dart'; | 7 import 'package:boolean_selector/boolean_selector.dart'; |
| 8 import 'package:collection/collection.dart' hide mapMap, mergeMaps; | 8 import 'package:collection/collection.dart' hide mapMap, mergeMaps; |
| 9 import 'package:glob/glob.dart'; | 9 import 'package:glob/glob.dart'; |
| 10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 final PlatformSelector testOn; | 62 final PlatformSelector testOn; |
| 63 | 63 |
| 64 /// Whether to pause for debugging after loading each test suite. | 64 /// Whether to pause for debugging after loading each test suite. |
| 65 bool get pauseAfterLoad => _pauseAfterLoad ?? false; | 65 bool get pauseAfterLoad => _pauseAfterLoad ?? false; |
| 66 final bool _pauseAfterLoad; | 66 final bool _pauseAfterLoad; |
| 67 | 67 |
| 68 /// The package root for resolving "package:" URLs. | 68 /// The package root for resolving "package:" URLs. |
| 69 String get packageRoot => _packageRoot ?? p.join(p.current, 'packages'); | 69 String get packageRoot => _packageRoot ?? p.join(p.current, 'packages'); |
| 70 final String _packageRoot; | 70 final String _packageRoot; |
| 71 | 71 |
| 72 /// The path to dart2js. |
| 73 String get dart2jsPath => _dart2jsPath ?? p.join(sdkDir, 'bin', 'dart2js'); |
| 74 final String _dart2jsPath; |
| 75 |
| 76 /// Additional arguments to pass to dart2js. |
| 77 final List<String> dart2jsArgs; |
| 78 |
| 72 /// The name of the reporter to use to display results. | 79 /// The name of the reporter to use to display results. |
| 73 String get reporter => _reporter ?? defaultReporter; | 80 String get reporter => _reporter ?? defaultReporter; |
| 74 final String _reporter; | 81 final String _reporter; |
| 75 | 82 |
| 76 /// The URL for the `pub serve` instance from which to load tests, or `null` | 83 /// The URL for the `pub serve` instance from which to load tests, or `null` |
| 77 /// if tests should be loaded from the filesystem. | 84 /// if tests should be loaded from the filesystem. |
| 78 final Uri pubServeUrl; | 85 final Uri pubServeUrl; |
| 79 | 86 |
| 80 /// The default test timeout. | 87 /// The default test timeout. |
| 81 /// | 88 /// |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 bool help, | 267 bool help, |
| 261 bool version, | 268 bool version, |
| 262 bool verboseTrace, | 269 bool verboseTrace, |
| 263 bool jsTrace, | 270 bool jsTrace, |
| 264 bool skip, | 271 bool skip, |
| 265 String skipReason, | 272 String skipReason, |
| 266 PlatformSelector testOn, | 273 PlatformSelector testOn, |
| 267 bool pauseAfterLoad, | 274 bool pauseAfterLoad, |
| 268 bool color, | 275 bool color, |
| 269 String packageRoot, | 276 String packageRoot, |
| 277 String dart2jsPath, |
| 278 Iterable<String> dart2jsArgs, |
| 270 String reporter, | 279 String reporter, |
| 271 int pubServePort, | 280 int pubServePort, |
| 272 int concurrency, | 281 int concurrency, |
| 273 int shardIndex, | 282 int shardIndex, |
| 274 int totalShards, | 283 int totalShards, |
| 275 Timeout timeout, | 284 Timeout timeout, |
| 276 Iterable<Pattern> patterns, | 285 Iterable<Pattern> patterns, |
| 277 Iterable<TestPlatform> platforms, | 286 Iterable<TestPlatform> platforms, |
| 278 Iterable<String> paths, | 287 Iterable<String> paths, |
| 279 Glob filename, | 288 Glob filename, |
| 280 Iterable<String> chosenPresets, | 289 Iterable<String> chosenPresets, |
| 281 BooleanSelector includeTags, | 290 BooleanSelector includeTags, |
| 282 BooleanSelector excludeTags, | 291 BooleanSelector excludeTags, |
| 283 Iterable<String> addTags, | 292 Iterable<String> addTags, |
| 284 Map<BooleanSelector, Configuration> tags, | 293 Map<BooleanSelector, Configuration> tags, |
| 285 Map<PlatformSelector, Configuration> onPlatform, | 294 Map<PlatformSelector, Configuration> onPlatform, |
| 286 Map<String, Configuration> presets}) { | 295 Map<String, Configuration> presets}) { |
| 287 _unresolved() => new Configuration._( | 296 _unresolved() => new Configuration._( |
| 288 help: help, | 297 help: help, |
| 289 version: version, | 298 version: version, |
| 290 verboseTrace: verboseTrace, | 299 verboseTrace: verboseTrace, |
| 291 jsTrace: jsTrace, | 300 jsTrace: jsTrace, |
| 292 skip: skip, | 301 skip: skip, |
| 293 skipReason: skipReason, | 302 skipReason: skipReason, |
| 294 testOn: testOn, | 303 testOn: testOn, |
| 295 pauseAfterLoad: pauseAfterLoad, | 304 pauseAfterLoad: pauseAfterLoad, |
| 296 color: color, | 305 color: color, |
| 297 packageRoot: packageRoot, | 306 packageRoot: packageRoot, |
| 307 dart2jsPath: dart2jsPath, |
| 308 dart2jsArgs: dart2jsArgs, |
| 298 reporter: reporter, | 309 reporter: reporter, |
| 299 pubServePort: pubServePort, | 310 pubServePort: pubServePort, |
| 300 concurrency: concurrency, | 311 concurrency: concurrency, |
| 301 shardIndex: shardIndex, | 312 shardIndex: shardIndex, |
| 302 totalShards: totalShards, | 313 totalShards: totalShards, |
| 303 timeout: timeout, | 314 timeout: timeout, |
| 304 patterns: patterns, | 315 patterns: patterns, |
| 305 platforms: platforms, | 316 platforms: platforms, |
| 306 paths: paths, | 317 paths: paths, |
| 307 filename: filename, | 318 filename: filename, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 bool help, | 366 bool help, |
| 356 bool version, | 367 bool version, |
| 357 bool verboseTrace, | 368 bool verboseTrace, |
| 358 bool jsTrace, | 369 bool jsTrace, |
| 359 bool skip, | 370 bool skip, |
| 360 this.skipReason, | 371 this.skipReason, |
| 361 PlatformSelector testOn, | 372 PlatformSelector testOn, |
| 362 bool pauseAfterLoad, | 373 bool pauseAfterLoad, |
| 363 bool color, | 374 bool color, |
| 364 String packageRoot, | 375 String packageRoot, |
| 376 String dart2jsPath, |
| 377 Iterable<String> dart2jsArgs, |
| 365 String reporter, | 378 String reporter, |
| 366 int pubServePort, | 379 int pubServePort, |
| 367 int concurrency, | 380 int concurrency, |
| 368 this.shardIndex, | 381 this.shardIndex, |
| 369 this.totalShards, | 382 this.totalShards, |
| 370 Timeout timeout, | 383 Timeout timeout, |
| 371 Iterable<Pattern> patterns, | 384 Iterable<Pattern> patterns, |
| 372 Iterable<TestPlatform> platforms, | 385 Iterable<TestPlatform> platforms, |
| 373 Iterable<String> paths, | 386 Iterable<String> paths, |
| 374 Glob filename, | 387 Glob filename, |
| 375 Iterable<String> chosenPresets, | 388 Iterable<String> chosenPresets, |
| 376 BooleanSelector includeTags, | 389 BooleanSelector includeTags, |
| 377 BooleanSelector excludeTags, | 390 BooleanSelector excludeTags, |
| 378 Iterable<String> addTags, | 391 Iterable<String> addTags, |
| 379 Map<BooleanSelector, Configuration> tags, | 392 Map<BooleanSelector, Configuration> tags, |
| 380 Map<PlatformSelector, Configuration> onPlatform, | 393 Map<PlatformSelector, Configuration> onPlatform, |
| 381 Map<String, Configuration> presets}) | 394 Map<String, Configuration> presets}) |
| 382 : _help = help, | 395 : _help = help, |
| 383 _version = version, | 396 _version = version, |
| 384 _verboseTrace = verboseTrace, | 397 _verboseTrace = verboseTrace, |
| 385 _jsTrace = jsTrace, | 398 _jsTrace = jsTrace, |
| 386 _skip = skip, | 399 _skip = skip, |
| 387 testOn = testOn ?? PlatformSelector.all, | 400 testOn = testOn ?? PlatformSelector.all, |
| 388 _pauseAfterLoad = pauseAfterLoad, | 401 _pauseAfterLoad = pauseAfterLoad, |
| 389 _color = color, | 402 _color = color, |
| 390 _packageRoot = packageRoot, | 403 _packageRoot = packageRoot, |
| 404 _dart2jsPath = dart2jsPath, |
| 405 dart2jsArgs = dart2jsArgs?.toList() ?? [], |
| 391 _reporter = reporter, | 406 _reporter = reporter, |
| 392 pubServeUrl = pubServePort == null | 407 pubServeUrl = pubServePort == null |
| 393 ? null | 408 ? null |
| 394 : Uri.parse("http://localhost:$pubServePort"), | 409 : Uri.parse("http://localhost:$pubServePort"), |
| 395 _concurrency = concurrency, | 410 _concurrency = concurrency, |
| 396 timeout = (pauseAfterLoad ?? false) | 411 timeout = (pauseAfterLoad ?? false) |
| 397 ? Timeout.none | 412 ? Timeout.none |
| 398 : (timeout == null ? new Timeout.factor(1) : timeout), | 413 : (timeout == null ? new Timeout.factor(1) : timeout), |
| 399 patterns = new UnmodifiableSetView(patterns?.toSet() ?? new Set()), | 414 patterns = new UnmodifiableSetView(patterns?.toSet() ?? new Set()), |
| 400 _platforms = _list(platforms), | 415 _platforms = _list(platforms), |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 help: other._help ?? _help, | 468 help: other._help ?? _help, |
| 454 version: other._version ?? _version, | 469 version: other._version ?? _version, |
| 455 verboseTrace: other._verboseTrace ?? _verboseTrace, | 470 verboseTrace: other._verboseTrace ?? _verboseTrace, |
| 456 jsTrace: other._jsTrace ?? _jsTrace, | 471 jsTrace: other._jsTrace ?? _jsTrace, |
| 457 skip: other._skip ?? _skip, | 472 skip: other._skip ?? _skip, |
| 458 skipReason: other.skipReason ?? skipReason, | 473 skipReason: other.skipReason ?? skipReason, |
| 459 testOn: testOn.intersection(other.testOn), | 474 testOn: testOn.intersection(other.testOn), |
| 460 pauseAfterLoad: other._pauseAfterLoad ?? _pauseAfterLoad, | 475 pauseAfterLoad: other._pauseAfterLoad ?? _pauseAfterLoad, |
| 461 color: other._color ?? _color, | 476 color: other._color ?? _color, |
| 462 packageRoot: other._packageRoot ?? _packageRoot, | 477 packageRoot: other._packageRoot ?? _packageRoot, |
| 478 dart2jsPath: other._dart2jsPath ?? _dart2jsPath, |
| 479 dart2jsArgs: dart2jsArgs.toList()..addAll(other.dart2jsArgs), |
| 463 reporter: other._reporter ?? _reporter, | 480 reporter: other._reporter ?? _reporter, |
| 464 pubServePort: (other.pubServeUrl ?? pubServeUrl)?.port, | 481 pubServePort: (other.pubServeUrl ?? pubServeUrl)?.port, |
| 465 concurrency: other._concurrency ?? _concurrency, | 482 concurrency: other._concurrency ?? _concurrency, |
| 466 shardIndex: other.shardIndex ?? shardIndex, | 483 shardIndex: other.shardIndex ?? shardIndex, |
| 467 totalShards: other.totalShards ?? totalShards, | 484 totalShards: other.totalShards ?? totalShards, |
| 468 timeout: timeout.merge(other.timeout), | 485 timeout: timeout.merge(other.timeout), |
| 469 patterns: patterns.union(other.patterns), | 486 patterns: patterns.union(other.patterns), |
| 470 platforms: other._platforms ?? _platforms, | 487 platforms: other._platforms ?? _platforms, |
| 471 paths: other._paths ?? _paths, | 488 paths: other._paths ?? _paths, |
| 472 filename: other._filename ?? _filename, | 489 filename: other._filename ?? _filename, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 492 bool help, | 509 bool help, |
| 493 bool version, | 510 bool version, |
| 494 bool verboseTrace, | 511 bool verboseTrace, |
| 495 bool jsTrace, | 512 bool jsTrace, |
| 496 bool skip, | 513 bool skip, |
| 497 String skipReason, | 514 String skipReason, |
| 498 PlatformSelector testOn, | 515 PlatformSelector testOn, |
| 499 bool pauseAfterLoad, | 516 bool pauseAfterLoad, |
| 500 bool color, | 517 bool color, |
| 501 String packageRoot, | 518 String packageRoot, |
| 519 String dart2jsPath, |
| 520 Iterable<String> dart2jsArgs, |
| 502 String reporter, | 521 String reporter, |
| 503 int pubServePort, | 522 int pubServePort, |
| 504 int concurrency, | 523 int concurrency, |
| 505 int shardIndex, | 524 int shardIndex, |
| 506 int totalShards, | 525 int totalShards, |
| 507 Timeout timeout, | 526 Timeout timeout, |
| 508 Iterable<Pattern> patterns, | 527 Iterable<Pattern> patterns, |
| 509 Iterable<TestPlatform> platforms, | 528 Iterable<TestPlatform> platforms, |
| 510 Iterable<String> paths, | 529 Iterable<String> paths, |
| 511 Glob filename, | 530 Glob filename, |
| 512 Iterable<String> chosenPresets, | 531 Iterable<String> chosenPresets, |
| 513 BooleanSelector includeTags, | 532 BooleanSelector includeTags, |
| 514 BooleanSelector excludeTags, | 533 BooleanSelector excludeTags, |
| 515 Iterable<String> addTags, | 534 Iterable<String> addTags, |
| 516 Map<BooleanSelector, Configuration> tags, | 535 Map<BooleanSelector, Configuration> tags, |
| 517 Map<PlatformSelector, Configuration> onPlatform, | 536 Map<PlatformSelector, Configuration> onPlatform, |
| 518 Map<String, Configuration> presets}) { | 537 Map<String, Configuration> presets}) { |
| 519 return new Configuration( | 538 return new Configuration( |
| 520 help: help ?? _help, | 539 help: help ?? _help, |
| 521 version: version ?? _version, | 540 version: version ?? _version, |
| 522 verboseTrace: verboseTrace ?? _verboseTrace, | 541 verboseTrace: verboseTrace ?? _verboseTrace, |
| 523 jsTrace: jsTrace ?? _jsTrace, | 542 jsTrace: jsTrace ?? _jsTrace, |
| 524 skip: skip ?? _skip, | 543 skip: skip ?? _skip, |
| 525 skipReason: skipReason ?? this.skipReason, | 544 skipReason: skipReason ?? this.skipReason, |
| 526 testOn: testOn ?? this.testOn, | 545 testOn: testOn ?? this.testOn, |
| 527 pauseAfterLoad: pauseAfterLoad ?? _pauseAfterLoad, | 546 pauseAfterLoad: pauseAfterLoad ?? _pauseAfterLoad, |
| 528 color: color ?? _color, | 547 color: color ?? _color, |
| 529 packageRoot: packageRoot ?? _packageRoot, | 548 packageRoot: packageRoot ?? _packageRoot, |
| 549 dart2jsPath: dart2jsPath ?? _dart2jsPath, |
| 550 dart2jsArgs: dart2jsArgs?.toList() ?? this.dart2jsArgs, |
| 530 reporter: reporter ?? _reporter, | 551 reporter: reporter ?? _reporter, |
| 531 pubServePort: pubServePort ?? pubServeUrl?.port, | 552 pubServePort: pubServePort ?? pubServeUrl?.port, |
| 532 concurrency: concurrency ?? _concurrency, | 553 concurrency: concurrency ?? _concurrency, |
| 533 shardIndex: shardIndex ?? this.shardIndex, | 554 shardIndex: shardIndex ?? this.shardIndex, |
| 534 totalShards: totalShards ?? this.totalShards, | 555 totalShards: totalShards ?? this.totalShards, |
| 535 timeout: timeout ?? this.timeout, | 556 timeout: timeout ?? this.timeout, |
| 536 patterns: patterns ?? this.patterns, | 557 patterns: patterns ?? this.patterns, |
| 537 platforms: platforms ?? _platforms, | 558 platforms: platforms ?? _platforms, |
| 538 paths: paths ?? _paths, | 559 paths: paths ?? _paths, |
| 539 filename: filename ?? _filename, | 560 filename: filename ?? _filename, |
| 540 chosenPresets: chosenPresets ?? this.chosenPresets, | 561 chosenPresets: chosenPresets ?? this.chosenPresets, |
| 541 includeTags: includeTags ?? this.includeTags, | 562 includeTags: includeTags ?? this.includeTags, |
| 542 excludeTags: excludeTags ?? this.excludeTags, | 563 excludeTags: excludeTags ?? this.excludeTags, |
| 543 addTags: addTags ?? this.addTags, | 564 addTags: addTags ?? this.addTags, |
| 544 tags: tags ?? this.tags, | 565 tags: tags ?? this.tags, |
| 545 onPlatform: onPlatform ?? this.onPlatform, | 566 onPlatform: onPlatform ?? this.onPlatform, |
| 546 presets: presets ?? this.presets); | 567 presets: presets ?? this.presets); |
| 547 } | 568 } |
| 548 | 569 |
| 549 /// Merges two maps whose values are [Configuration]s. | 570 /// Merges two maps whose values are [Configuration]s. |
| 550 /// | 571 /// |
| 551 /// Any overlapping keys in the maps have their configurations merged in the | 572 /// Any overlapping keys in the maps have their configurations merged in the |
| 552 /// returned map. | 573 /// returned map. |
| 553 Map<Object, Configuration> _mergeConfigMaps(Map<Object, Configuration> map1, | 574 Map<Object, Configuration> _mergeConfigMaps(Map<Object, Configuration> map1, |
| 554 Map<Object, Configuration> map2) => | 575 Map<Object, Configuration> map2) => |
| 555 mergeMaps(map1, map2, | 576 mergeMaps(map1, map2, |
| 556 value: (config1, config2) => config1.merge(config2)); | 577 value: (config1, config2) => config1.merge(config2)); |
| 557 } | 578 } |
| OLD | NEW |