Chromium Code Reviews

Unified Diff: lib/src/executable.dart

Issue 1649663003: Add basic support for a configuration file. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: lib/src/executable.dart
diff --git a/lib/src/executable.dart b/lib/src/executable.dart
index fa9e2f191700e80b1fe733c0623a7284d1ccfdda..8dd546ec7bbcb36777e12f944e3bf3128ccc77af 100644
--- a/lib/src/executable.dart
+++ b/lib/src/executable.dart
@@ -7,6 +7,7 @@
// bin.
import 'dart:io';
+import 'package:source_span/source_span.dart';
import 'package:stack_trace/stack_trace.dart';
import 'package:yaml/yaml.dart';
@@ -84,6 +85,25 @@ main(List<String> args) async {
return;
}
+ try {
+ if (new File("dart_test.yaml").existsSync()) {
+ var fileConfiguration = new Configuration.load("dart_test.yaml");
+ configuration = fileConfiguration.merge(configuration);
+ }
+ } on SourceSpanFormatException catch (error) {
+ stderr.writeln(error.toString(color: configuration.color));
+ exitCode = exit_codes.data;
+ return;
+ } on FormatException catch (error) {
+ stderr.writeln(error.message);
+ exitCode = exit_codes.data;
+ return;
+ } on IOException catch (error) {
+ stderr.writeln(error.toString());
+ exitCode = exit_codes.noInput;
+ return;
+ }
+
if (configuration.pubServeUrl != null && !_usesTransformer) {
stderr.write('''
When using --pub-serve, you must include the "test/pub_serve" transformer in

Powered by Google App Engine