Index: packages/dart_style/test/utils.dart |
diff --git a/packages/dart_style/test/utils.dart b/packages/dart_style/test/utils.dart |
index 2c555d033826334885ba3ea667d1626299e69468..a2bacc539e81cdfc8498398434b21d611515e418 100644 |
--- a/packages/dart_style/test/utils.dart |
+++ b/packages/dart_style/test/utils.dart |
@@ -5,6 +5,7 @@ |
library dart_style.test.utils; |
import 'dart:io'; |
+import 'dart:mirrors'; |
import 'package:path/path.dart' as p; |
import 'package:scheduled_test/descriptor.dart' as d; |
@@ -18,7 +19,12 @@ const formattedSource = 'void main() => print("hello");\n'; |
ScheduledProcess runFormatter([List<String> args]) { |
if (args == null) args = []; |
- var formatterPath = p.join("bin", "format.dart"); |
+ // Locate the "test" directory. Use mirrors so that this works with the test |
+ // package, which loads this suite into an isolate. |
+ var testDir = p.dirname( |
+ currentMirrorSystem().findLibrary(#dart_style.test.utils).uri.path); |
+ |
+ var formatterPath = p.normalize(p.join(testDir, "../bin/format.dart")); |
args.insert(0, formatterPath); |