| 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:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:async/async.dart'; | 8 import 'package:async/async.dart'; |
| 9 | 9 |
| 10 import 'backend/group.dart'; | 10 import 'backend/group.dart'; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 /// This is stored so that we can cancel it when the runner is closed. | 61 /// This is stored so that we can cancel it when the runner is closed. |
| 62 CancelableOperation _debugOperation; | 62 CancelableOperation _debugOperation; |
| 63 | 63 |
| 64 /// The memoizer for ensuring [close] only runs once. | 64 /// The memoizer for ensuring [close] only runs once. |
| 65 final _closeMemo = new AsyncMemoizer(); | 65 final _closeMemo = new AsyncMemoizer(); |
| 66 bool get _closed => _closeMemo.hasRun; | 66 bool get _closed => _closeMemo.hasRun; |
| 67 | 67 |
| 68 /// Creates a new runner based on [configuration]. | 68 /// Creates a new runner based on [configuration]. |
| 69 factory Runner(Configuration config) { | 69 factory Runner(Configuration config) { |
| 70 var loader = new Loader(config); | 70 var loader = new Loader(config); |
| 71 var engine = new Engine(concurrency: config.concurrency); | 71 var engine = new Engine( |
| 72 concurrency: config.concurrency, |
| 73 runSkipped: config.runSkipped); |
| 72 | 74 |
| 73 var reporter; | 75 var reporter; |
| 74 switch (config.reporter) { | 76 switch (config.reporter) { |
| 75 case "compact": | 77 case "compact": |
| 76 case "expanded": | 78 case "expanded": |
| 77 var watch = config.reporter == "compact" | 79 var watch = config.reporter == "compact" |
| 78 ? CompactReporter.watch | 80 ? CompactReporter.watch |
| 79 : ExpandedReporter.watch; | 81 : ExpandedReporter.watch; |
| 80 | 82 |
| 81 reporter = watch( | 83 reporter = watch( |
| 82 engine, | 84 engine, |
| 83 color: config.color, | 85 color: config.color, |
| 84 verboseTrace: config.verboseTrace, | 86 verboseTrace: config.verboseTrace, |
| 85 printPath: config.paths.length > 1 || | 87 printPath: config.paths.length > 1 || |
| 86 new Directory(config.paths.single).existsSync(), | 88 new Directory(config.paths.single).existsSync(), |
| 87 printPlatform: config.platforms.length > 1); | 89 printPlatform: config.platforms.length > 1); |
| 88 break; | 90 break; |
| 89 | 91 |
| 90 case "json": | 92 case "json": |
| 91 reporter = JsonReporter.watch(engine, | 93 reporter = JsonReporter.watch(engine, |
| 92 verboseTrace: config.verboseTrace, jsLocations: !config.jsTrace); | 94 verboseTrace: config.verboseTrace, |
| 95 jsLocations: !config.jsTrace, |
| 96 runSkipped: config.runSkipped); |
| 93 break; | 97 break; |
| 94 } | 98 } |
| 95 | 99 |
| 96 return new Runner._(config, loader, engine, reporter); | 100 return new Runner._(config, loader, engine, reporter); |
| 97 } | 101 } |
| 98 | 102 |
| 99 Runner._(this._config, this._loader, this._engine, this._reporter); | 103 Runner._(this._config, this._loader, this._engine, this._reporter); |
| 100 | 104 |
| 101 /// Starts the runner. | 105 /// Starts the runner. |
| 102 /// | 106 /// |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 await _debugOperation.valueOrCancellation(); | 378 await _debugOperation.valueOrCancellation(); |
| 375 }).listen(null); | 379 }).listen(null); |
| 376 | 380 |
| 377 var results = await Future.wait([ | 381 var results = await Future.wait([ |
| 378 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), | 382 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), |
| 379 _engine.run() | 383 _engine.run() |
| 380 ]); | 384 ]); |
| 381 return results.last; | 385 return results.last; |
| 382 } | 386 } |
| 383 } | 387 } |
| OLD | NEW |