[test_runner] Use 'line' progress indicator by default when stdout is not a terminal
When the test runner output is piped to a file, 'compact' progress
indicator prints carriage returns to the file.
To avoid adding carriage returns to text files, only use 'compact'
indicator when stdout is a terminal. Otherwise use 'line' indicator.
Change-Id: Ic8ca111059799876caf401d3b040a5d3b5a7c731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431861
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
diff --git a/pkg/test_runner/lib/src/options.dart b/pkg/test_runner/lib/src/options.dart
index bb593d8..7f3b0ba 100644
--- a/pkg/test_runner/lib/src/options.dart
+++ b/pkg/test_runner/lib/src/options.dart
@@ -180,7 +180,9 @@
..addOption('progress',
abbr: 'p',
allowed: Progress.names,
- defaultsTo: Progress.compact.name,
+ defaultsTo: stdioType(stdout) == StdioType.terminal
+ ? Progress.compact.name
+ : Progress.line.name,
help: '''Progress indication mode.
Allowed values are:
diff --git a/pkg/test_runner/test/options_test.dart b/pkg/test_runner/test/options_test.dart
index 98c3cff..449a003 100644
--- a/pkg/test_runner/test/options_test.dart
+++ b/pkg/test_runner/test/options_test.dart
@@ -18,7 +18,6 @@
void testDefaults() {
// TODO(rnystrom): Test other options.
var configuration = parseConfiguration([]);
- Expect.equals(Progress.compact, configuration.progress);
Expect.equals(NnbdMode.strong, configuration.nnbdMode);
}