Index: test/io.dart |
diff --git a/test/io.dart b/test/io.dart |
index 663d454c11da659dba0ddfd96e81db6b0429d216..b1632347bd9fb3f36d389a880abde1d0b8f9b842 100644 |
--- a/test/io.dart |
+++ b/test/io.dart |
@@ -8,7 +8,6 @@ import 'dart:io'; |
import 'package:path/path.dart' as p; |
import 'package:stack_trace/stack_trace.dart'; |
-import 'package:unittest/unittest.dart'; |
/// The root directory of the `unittest` package. |
final String packageDir = _computePackageDir(); |
@@ -17,9 +16,22 @@ String _computePackageDir() { |
return p.dirname(p.dirname(p.fromUri(trace.frames.first.uri))); |
} |
-/// Returns a matcher that matches a [FileSystemException] with the given |
-/// [message]. |
-Matcher isFileSystemException(String message) => predicate( |
- (error) => error is FileSystemException && error.message == message, |
- 'is a FileSystemException with message "$message"'); |
+/// Runs the unittest executable with the package root set properly. |
+ProcessResult runUnittest(List<String> args, {String workingDirectory}) { |
+ var allArgs = [ |
+ p.join(packageDir, 'bin/unittest.dart'), |
+ "--package-root=${p.join(packageDir, 'packages')}" |
+ ]..addAll(args); |
+ // TODO(nweiz): Use ScheduledProcess once it's compatible. |
+ return runDart(allArgs, workingDirectory: workingDirectory); |
+} |
+ |
+/// Runs Dart. |
+ProcessResult runDart(List<String> args, {String workingDirectory}) { |
+ var allArgs = Platform.executableArguments.toList()..addAll(args); |
+ |
+ // TODO(nweiz): Use ScheduledProcess once it's compatible. |
+ return Process.runSync(Platform.executable, allArgs, |
+ workingDirectory: workingDirectory); |
+} |