From 7b3b3626232e00a42cab12668219f751f7d385f2 Mon Sep 17 00:00:00 2001 From: Mouad Debbar Date: Fri, 12 May 2023 17:50:22 -0400 Subject: [PATCH] [web] Cleaner output on LUCI (flutter/engine#41989) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using ansi colors in LUCI results in output that looks like: ``` 00:00 +0: loading flutter_tester_emulation_golden_test.dart 00:01 +0: loading flutter_tester_emulation_golden_test.dart 00:02 +0: loading flutter_tester_emulation_golden_test.dart ``` This PR disables colors on LUCI so that we get clean output that's easily scannable and searchable. --- .../src/flutter/lib/web_ui/dev/steps/run_suite_step.dart | 1 + engine/src/flutter/lib/web_ui/dev/utils.dart | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/lib/web_ui/dev/steps/run_suite_step.dart b/engine/src/flutter/lib/web_ui/dev/steps/run_suite_step.dart index d069688a07b..b78e6ac9d71 100644 --- a/engine/src/flutter/lib/web_ui/dev/steps/run_suite_step.dart +++ b/engine/src/flutter/lib/web_ui/dev/steps/run_suite_step.dart @@ -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. diff --git a/engine/src/flutter/lib/web_ui/dev/utils.dart b/engine/src/flutter/lib/web_ui/dev/utils.dart index c3b6de87c5d..a51c78b2ec3 100644 --- a/engine/src/flutter/lib/web_ui/dev/utils.dart +++ b/engine/src/flutter/lib/web_ui/dev/utils.dart @@ -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'; @@ -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';