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

Unified Diff: lib/src/io.dart

Issue 1215833002: Use the new test runner. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | pubspec.yaml » ('j') | test/build/copies_browser_js_with_dependency_override_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/io.dart
diff --git a/lib/src/io.dart b/lib/src/io.dart
index 24c45d88776a9233c5be718b28590911ae808e51..45a26a11669bc644303ca70a8beae56bf35299e7 100644
--- a/lib/src/io.dart
+++ b/lib/src/io.dart
@@ -482,6 +482,15 @@ void createPackageSymlink(String name, String target, String symlink,
final bool runningAsTest =
!path.url.basename(Platform.script.path).startsWith('pub.');
+// TODO(nweiz): Use the test API when test#48 is fixed.
+/// Whether the current process is one of pub's test files being run through the
+/// test package's test runner.
+///
+/// The test runner starts all tests from an entrypoint called
+/// "runInIsolate.dart'>
+final bool runningAsTestRunner =
+ path.url.basename(Platform.script.path).startsWith('runInIsolate.dart');
+
/// Whether the current process is a pub subprocess being run from a test.
///
/// The "_PUB_TESTING" variable is automatically set for all the test code's
@@ -535,6 +544,9 @@ final String pubRoot = (() {
throw new StateError("Can't get pub's root from the SDK.");
}
+ // The test runner always runs from the working directory.
+ if (runningAsTestRunner) return path.current;
+
var script = path.fromUri(Platform.script);
if (runningAsTest) {
// Running from "test/../some_test.dart".
« no previous file with comments | « no previous file | pubspec.yaml » ('j') | test/build/copies_browser_js_with_dependency_override_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698