Skip to content

Commit

Permalink
[web] Cleaner output on LUCI (#41989)
Browse files Browse the repository at this point in the history
Using ansi colors in LUCI results in output that looks like:
```
00:00 �[32m+0�[0m: �[1m�[90mloading flutter_tester_emulation_golden_test.dart�[0m�[0m                                                                                                                                            
00:01 �[32m+0�[0m: �[1m�[90mloading flutter_tester_emulation_golden_test.dart�[0m�[0m                                                                                                                                            
00:02 �[32m+0�[0m: �[1m�[90mloading flutter_tester_emulation_golden_test.dart�[0m�[0m
```

This PR disables colors on LUCI so that we get clean output that's easily scannable and searchable.
  • Loading branch information
mdebbar committed May 12, 2023
1 parent 44805c2 commit 968cd95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/web_ui/dev/steps/run_suite_step.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class RunSuiteStep implements PipelineStep {
'--platform=${browserEnvironment.packageTestRuntime.identifier}',
'--precompiled=$bundleBuildPath',
'--configuration=$configurationFilePath',
if (AnsiColors.shouldEscape) '--color' else '--no-color',

// TODO(jacksongardner): Set the default timeout to five minutes when
// https://github.com/dart-lang/test/issues/2006 is fixed.
Expand Down
9 changes: 8 additions & 1 deletion lib/web_ui/dev/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:args/command_runner.dart';
import 'package:meta/meta.dart';
import 'package:path/path.dart' as path;

import 'common.dart';
import 'environment.dart';
import 'exceptions.dart';
import 'felt_config.dart';
Expand Down Expand Up @@ -428,7 +429,13 @@ io.Directory getSkiaGoldDirectoryForSuite(TestSuite suite) {
}

extension AnsiColors on String {
static bool shouldEscape = io.stdout.hasTerminal && io.stdout.supportsAnsiEscapes;
static bool shouldEscape = () {
if (isLuci) {
// Produce clean output on LUCI.
return false;
}
return io.stdout.hasTerminal && io.stdout.supportsAnsiEscapes;
}();

static const String _noColorCode = '\u001b[39m';

Expand Down

0 comments on commit 968cd95

Please sign in to comment.