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 // TODO(nweiz): This is under lib so that it can be used by the unittest dummy | 5 // TODO(nweiz): This is under lib so that it can be used by the unittest dummy |
6 // package. Once that package is no longer being updated, move this back into | 6 // package. Once that package is no longer being updated, move this back into |
7 // bin. | 7 // bin. |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
| 10 import 'package:async/async.dart'; |
10 import 'package:path/path.dart' as p; | 11 import 'package:path/path.dart' as p; |
11 import 'package:source_span/source_span.dart'; | 12 import 'package:source_span/source_span.dart'; |
12 import 'package:stack_trace/stack_trace.dart'; | 13 import 'package:stack_trace/stack_trace.dart'; |
13 import 'package:yaml/yaml.dart'; | 14 import 'package:yaml/yaml.dart'; |
14 | 15 |
15 import 'runner.dart'; | 16 import 'runner.dart'; |
16 import 'runner/application_exception.dart'; | 17 import 'runner/application_exception.dart'; |
17 import 'runner/configuration.dart'; | 18 import 'runner/configuration.dart'; |
18 import 'runner/version.dart'; | 19 import 'runner/version.dart'; |
19 import 'util/exit_codes.dart' as exit_codes; | 20 import 'util/exit_codes.dart' as exit_codes; |
20 import 'util/io.dart'; | 21 import 'util/io.dart'; |
21 import 'utils.dart'; | 22 import 'utils.dart'; |
22 | 23 |
23 /// A merged stream of all signals that tell the test runner to shut down | 24 /// A merged stream of all signals that tell the test runner to shut down |
24 /// gracefully. | 25 /// gracefully. |
25 /// | 26 /// |
26 /// Signals will only be captured as long as this has an active subscription. | 27 /// Signals will only be captured as long as this has an active subscription. |
27 /// Otherwise, they'll be handled by Dart's default signal handler, which | 28 /// Otherwise, they'll be handled by Dart's default signal handler, which |
28 /// terminates the program immediately. | 29 /// terminates the program immediately. |
29 final _signals = Platform.isWindows | 30 final _signals = Platform.isWindows |
30 ? ProcessSignal.SIGINT.watch() | 31 ? ProcessSignal.SIGINT.watch() |
31 : mergeStreams([ | 32 : StreamGroup.merge([ |
32 ProcessSignal.SIGTERM.watch(), | 33 ProcessSignal.SIGTERM.watch(), |
33 ProcessSignal.SIGINT.watch() | 34 ProcessSignal.SIGINT.watch() |
34 ]); | 35 ]); |
35 | 36 |
36 /// Returns whether the current package has a pubspec which uses the | 37 /// Returns whether the current package has a pubspec which uses the |
37 /// `test/pub_serve` transformer. | 38 /// `test/pub_serve` transformer. |
38 bool get _usesTransformer { | 39 bool get _usesTransformer { |
39 if (!new File('pubspec.yaml').existsSync()) return false; | 40 if (!new File('pubspec.yaml').existsSync()) return false; |
40 var contents = new File('pubspec.yaml').readAsStringSync(); | 41 var contents = new File('pubspec.yaml').readAsStringSync(); |
41 | 42 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 output = stderr; | 201 output = stderr; |
201 } | 202 } |
202 | 203 |
203 output.write("""${wordWrap(message)} | 204 output.write("""${wordWrap(message)} |
204 | 205 |
205 Usage: pub run test [files or directories...] | 206 Usage: pub run test [files or directories...] |
206 | 207 |
207 ${Configuration.usage} | 208 ${Configuration.usage} |
208 """); | 209 """); |
209 } | 210 } |
OLD | NEW |