Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: lib/src/runner/loader.dart

Issue 1055083004: Normalize handling of the package root in the runner. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Unused import Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/runner/browser/server.dart ('k') | lib/src/util/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/loader.dart
diff --git a/lib/src/runner/loader.dart b/lib/src/runner/loader.dart
index 475e10d5f277024a6c4a9c281b9928362d033ae5..f2936b9099b8775e30a89f1a7490b90daab4ad1d 100644
--- a/lib/src/runner/loader.dart
+++ b/lib/src/runner/loader.dart
@@ -35,8 +35,7 @@ class Loader {
/// The root directory that will be served for browser tests.
final String _root;
- /// The package root to use for loading tests, or `null` to use the automatic
- /// root.
+ /// The package root to use for loading tests.
final String _packageRoot;
/// The URL for the `pub serve` instance to use to load tests.
@@ -71,19 +70,20 @@ class Loader {
/// defaults to the working directory.
///
/// If [packageRoot] is passed, it's used as the package root for all loaded
- /// tests. Otherwise, the `packages/` directories next to the test entrypoints
- /// will be used.
+ /// tests. Otherwise, it's inferred from [root].
///
/// If [pubServeUrl] is passed, tests will be loaded from the `pub serve`
/// instance at that URL rather than from the filesystem.
///
/// If [color] is true, console colors will be used when compiling Dart.
+ ///
+ /// If the package root doesn't exist, throws an [ApplicationException].
Loader(Iterable<TestPlatform> platforms, {String root, String packageRoot,
Uri pubServeUrl, bool color: false})
: _platforms = platforms.toList(),
_pubServeUrl = pubServeUrl,
_root = root == null ? p.current : root,
- _packageRoot = packageRoot,
+ _packageRoot = packageRootFor(root, packageRoot),
_color = color;
/// Loads all test suites in [dir].
@@ -156,7 +156,6 @@ class Loader {
/// Load the test suite at [path] in VM isolate.
Future<Suite> _loadVmFile(String path) {
- var packageRoot = packageRootFor(path, _packageRoot);
var receivePort = new ReceivePort();
return new Future.sync(() {
@@ -192,7 +191,7 @@ void main(_, Map message) {
}
''', {
'reply': receivePort.sendPort
- }, packageRoot: packageRoot);
+ }, packageRoot: _packageRoot);
}
}).catchError((error, stackTrace) {
receivePort.close();
« no previous file with comments | « lib/src/runner/browser/server.dart ('k') | lib/src/util/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698