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". |