OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library testing.discover; | 5 library testing.discover; |
6 | 6 |
7 import 'dart:io' show Directory, FileSystemEntity, Platform, Process; | 7 import 'dart:io' show Directory, FileSystemEntity, Platform, Process; |
8 | 8 |
9 import 'dart:async' show Future, Stream, StreamController, StreamSubscription; | 9 import 'dart:async' show Future, Stream, StreamController, StreamSubscription; |
10 | 10 |
11 import '../testing.dart' show TestDescription; | 11 import '../testing.dart' show TestDescription; |
12 | 12 |
13 final Uri packageConfig = computePackageConfig(); | 13 final Uri packageConfig = computePackageConfig(); |
14 | 14 |
15 final Uri dartSdk = computeDartSdk(); | 15 final Uri dartSdk = computeDartSdk(); |
16 | 16 |
17 /// Common arguments when running a dart program. Returns a copy that can | 17 /// Common arguments when running a dart program. Returns a copy that can |
18 /// safely be modified by caller. | 18 /// safely be modified by caller. |
19 List<String> get dartArguments => <String>["-c", "--packages=$packageConfig"]; | 19 List<String> get dartArguments => |
| 20 <String>["-c", "--packages=${packageConfig.toFilePath()}"]; |
20 | 21 |
21 Stream<TestDescription> listTests(List<Uri> testRoots, {Pattern pattern}) { | 22 Stream<TestDescription> listTests(List<Uri> testRoots, {Pattern pattern}) { |
22 StreamController<TestDescription> controller = | 23 StreamController<TestDescription> controller = |
23 new StreamController<TestDescription>(); | 24 new StreamController<TestDescription>(); |
24 Map<Uri, StreamSubscription> subscriptions = <Uri, StreamSubscription>{}; | 25 Map<Uri, StreamSubscription> subscriptions = <Uri, StreamSubscription>{}; |
25 for (Uri testRootUri in testRoots) { | 26 for (Uri testRootUri in testRoots) { |
26 subscriptions[testRootUri] = null; | 27 subscriptions[testRootUri] = null; |
27 Directory testRoot = new Directory.fromUri(testRootUri); | 28 Directory testRoot = new Directory.fromUri(testRootUri); |
28 testRoot.exists().then((bool exists) { | 29 testRoot.exists().then((bool exists) { |
29 if (exists) { | 30 if (exists) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 Future<Process> startDart(Uri program, | 76 Future<Process> startDart(Uri program, |
76 [List<String> arguments, List<String> vmArguments]) { | 77 [List<String> arguments, List<String> vmArguments]) { |
77 List<String> allArguments = <String>[]; | 78 List<String> allArguments = <String>[]; |
78 allArguments.addAll(vmArguments ?? dartArguments); | 79 allArguments.addAll(vmArguments ?? dartArguments); |
79 allArguments.add(program.toFilePath()); | 80 allArguments.add(program.toFilePath()); |
80 if (arguments != null) { | 81 if (arguments != null) { |
81 allArguments.addAll(arguments); | 82 allArguments.addAll(arguments); |
82 } | 83 } |
83 return Process.start(Platform.resolvedExecutable, allArguments); | 84 return Process.start(Platform.resolvedExecutable, allArguments); |
84 } | 85 } |
OLD | NEW |