Skip to content

fix(logger): Preserve box alignment for ANSI-styled warnings/errors#105

Open
SergioChan wants to merge 7 commits into
serverpod:mainfrom
SergioChan:fix-boxlog-ansi-line-length
Open

fix(logger): Preserve box alignment for ANSI-styled warnings/errors#105
SergioChan wants to merge 7 commits into
serverpod:mainfrom
SergioChan:fix-boxlog-ansi-line-length

Conversation

@SergioChan
Copy link
Copy Markdown

@SergioChan SergioChan commented Mar 9, 2026

Summary

  • fix box rendering for warning/error logs when ANSI coloring is enabled
  • strip ANSI escape codes before computing wrapped line widths and padding inside _formatAsBox
  • re-apply level styling to the fully formatted box so visible borders and content keep consistent widths

Testing

  • Not run locally: dart is not available in this execution environment (dart: command not found), so I could not execute dart test.
  • Manual verification approach used for the fix: inspected the formatting path to ensure width calculations now use plain text and no longer include ANSI control sequences.

Related

Fixes #104

Summary by CodeRabbit

  • Bug Fixes
    • Boxed log messages now strip existing ANSI escape sequences before boxing and reapply level-based styling afterward, preventing visual corruption and ensuring correct box sizing and colors.
  • Tests
    • Added tests verifying boxed message rendering, confirming ANSI-styled text and other control sequences are stripped for sizing and rendered correctly in a box.
  • Chores
    • Test harness updated to simulate ANSI-capable output for these scenarios.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 9, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

StdOutLogger now strips ANSI escape sequences from messages before boxing to compute correct widths, then reapplies level-specific ANSI styling; tests and test utilities were updated to support ANSI-aware stdout mocking and to validate boxed output with ANSI and control sequences.

Changes

Cohort / File(s) Summary
StdOutLogger ANSI handling
packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart
Extracted inline styling into _styleByLevel() and added _stripAnsiCodes(); strip ANSI codes prior to BoxLogType width calculation and reapply level-based styling to the boxed output.
Tests — BoxLogType behavior
packages/cli_tools/test/std_out_logger_test.dart
Added test group validating boxed rendering with title, that SGR ANSI styling is stripped before boxing and restyled after, and that other control sequences are stripped for width calculation.
Test utilities — stdout ANSI support
packages/cli_tools/test/test_utils/io_helper.dart, packages/cli_tools/test/test_utils/mock_stdout.dart
Propagated new ansiSupported flag through collectOutput() to MockStdout; MockStdout now accepts ansiSupported and exposes supportsAnsiEscapes => ansiSupported so tests can simulate ANSI-capable stdout.

Sequence Diagram(s)

(omitted — changes are local to logger and tests, not multi-component sequential flows)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • SandPod
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main fix: preserving box alignment for ANSI-styled warnings/errors, which is the core objective of the changeset.
Linked Issues check ✅ Passed The PR fully addresses issue #104's requirements: strips ANSI codes before width calculations, re-applies styling after boxing, and includes tests validating the fix for both plain and styled output.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing box rendering for ANSI-styled logs: refactoring StdOutLogger styling logic, adding helper methods, updating test utilities to support ANSI testing, and adding comprehensive test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart (1)

243-251: Consider consolidating duplicate styling logic.

This switch statement is identical to the one in the log() method (lines 97-103). Using _styleByLevel in both places would eliminate the duplication and reduce the risk of the two diverging if styling requirements change.

♻️ Proposed refactor to consolidate styling
   void log(
     final String message,
     final LogLevel level, {
     final bool newParagraph = false,
     final LogType type = TextLogType.normal,
   }) {
     if (ansiSupported) {
-      final ansiMessage = switch (level) {
-        LogLevel.debug => AnsiStyle.darkGray.wrap(message),
-        LogLevel.info => message,
-        LogLevel.warning => AnsiStyle.yellow.wrap(message),
-        LogLevel.error => AnsiStyle.red.wrap(message),
-        LogLevel.nothing => message,
-      };
+      final ansiMessage = _styleByLevel(message, level);

       _log(ansiMessage, level, newParagraph, type);
     } else {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart` around lines
243 - 251, The switch-based styling logic duplicated in the log() method should
be consolidated to use the existing helper _styleByLevel(String message,
LogLevel level); update the log() implementation to call _styleByLevel(message,
level) instead of repeating the switch, and remove the redundant switch block so
styling is centralized in _styleByLevel (ensure imports/signatures remain
compatible with LogLevel and AnsiStyle).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart`:
- Around line 243-251: The switch-based styling logic duplicated in the log()
method should be consolidated to use the existing helper _styleByLevel(String
message, LogLevel level); update the log() implementation to call
_styleByLevel(message, level) instead of repeating the switch, and remove the
redundant switch block so styling is centralized in _styleByLevel (ensure
imports/signatures remain compatible with LogLevel and AnsiStyle).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: da9b3afa-e54a-458d-a516-b4f651258285

📥 Commits

Reviewing files that changed from the base of the PR and between 2be6d0e and db2ab95.

📒 Files selected for processing (1)
  • packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart

@SergioChan SergioChan changed the title fix(logger): preserve box alignment for ANSI-styled warnings/errors fix(logger): Preserve box alignment for ANSI-styled warnings/errors Mar 9, 2026
@SergioChan
Copy link
Copy Markdown
Author

Thanks for the review — addressed.

Updates pushed

  • Refactored log() to reuse _styleByLevel(message, level) instead of duplicating the switch.
  • Kept the ANSI width fix intact (strip ANSI for box width calculation, then re-apply styling after formatting).
  • Updated the PR title subject to satisfy the repository semantic-title check.

Please re-check when convenient.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart (1)

153-161: Core fix looks correct.

The approach of stripping ANSI codes before computing box dimensions and re-applying styling afterward properly addresses the alignment issue.

Minor edge case: The title passed to _formatAsBox (line 157) is not stripped of ANSI codes. If a title contains ANSI sequences, title.length at line 320 would include escape characters, potentially causing the same misalignment in the title row. Consider applying _stripAnsiCodes to the title as well for completeness, or document that titles should be plain text.

,

🔧 Optional fix for title consistency
     if (type is BoxLogType) {
       message = _formatAsBox(
         wrapColumn: wrapTextColumn ?? _defaultColumnWrap,
         message: _stripAnsiCodes(message),
-        title: type.title,
+        title: type.title != null ? _stripAnsiCodes(type.title!) : null,
       );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart` around lines
153 - 161, The title passed to _formatAsBox can contain ANSI codes which will
skew box width calculations; update the BoxLogType handling so the title
argument is passed through _stripAnsiCodes (similar to message) before calling
_formatAsBox, i.e., apply _stripAnsiCodes to the title variable in the block
where _formatAsBox is invoked (the same block that later re-applies styling with
_styleByLevel) to ensure title length is measured against plain text.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart`:
- Around line 153-161: The title passed to _formatAsBox can contain ANSI codes
which will skew box width calculations; update the BoxLogType handling so the
title argument is passed through _stripAnsiCodes (similar to message) before
calling _formatAsBox, i.e., apply _stripAnsiCodes to the title variable in the
block where _formatAsBox is invoked (the same block that later re-applies
styling with _styleByLevel) to ensure title length is measured against plain
text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 02ed9464-138f-4531-ab3f-34337671ebee

📥 Commits

Reviewing files that changed from the base of the PR and between db2ab95 and 56df24b.

📒 Files selected for processing (1)
  • packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart

@SergioChan
Copy link
Copy Markdown
Author

Thanks for the follow-up review — good catch.

I pushed a small update to strip ANSI sequences from title before _formatAsBox computes widths, matching how message is already handled:

  • title: type.title != null ? _stripAnsiCodes(type.title!) : null

This keeps box title width calculations consistent even if a styled title is ever passed.

Validation:

  • I verified the change is minimal and localized to StdOutLogger box formatting path.
  • I couldn't run Dart checks in this environment because dart is not installed (dart: command not found).

Copy link
Copy Markdown
Collaborator

@christerswahn christerswahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing!

You need to add tests. See std_out_logger_test.dart. Follow the given - when - then test structure convention. I see now that there aren't any existing test cases for calling log() with the BoxLogType, please add for both the normal cases and your fixed case.

wrapColumn: wrapTextColumn ?? _defaultColumnWrap,
message: message,
title: type.title,
message: _stripAnsiCodes(message),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest moving the ansi code wrapping to the _log() method, and avoid wrapping, unwrapping, and wrapping again.

@SergioChan
Copy link
Copy Markdown
Author

Thanks — added the requested tests in std_out_logger_test.dart following the given/when/then naming style.

Added coverage

  • BoxLogType normal case: verifies expected box framing for plain text output.
  • BoxLogType fixed case: verifies ANSI-styled message/title are stripped before box width calculation (no escape sequences in final boxed output, aligned borders).

Notes on validation

  • I could not run dart test in this environment because the dart CLI is unavailable (dart: command not found).
  • The change is test-only and limited to packages/cli_tools/test/std_out_logger_test.dart.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart (1)

247-249: Broaden _stripAnsiCodes or narrow its name.

This regex only removes SGR color sequences (...m). Other ANSI control sequences will still count toward width and can reintroduce box misalignment if callers pass richer terminal escapes.

Suggested change
 String _stripAnsiCodes(final String input) {
-  final ansiRegex = RegExp(r'\x1B\[[0-9;]*m');
+  final ansiRegex = RegExp(r'\x1B(?:[`@-Z`\\-_]|\[[0-?]*[ -/]*[`@-`~])');
   return input.replaceAll(ansiRegex, '');
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart` around lines
247 - 249, The _stripAnsiCodes function currently only removes SGR color
sequences and should either be renamed to reflect that limitation or expanded to
strip all common ANSI control sequences; update _stripAnsiCodes to remove not
just SGR ("\x1B[...m") but also CSI sequences ending with bytes in the range
`@-`~, OSC sequences (ESC ] ... BEL or ESC \ terminators), single-character
escapes (ESC followed by control byte), and other ESC sequences so terminal
control codes no longer contribute to visible width, then run/update any tests
or callers that depend on box alignment to validate the fix.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/cli_tools/test/std_out_logger_test.dart`:
- Around line 160-176: The test is non-deterministic across ANSI environments;
update it to exercise both paths by calling collectOutput twice (or passing an
ansiSupported=true flag if collectOutput supports it) around logger.warning with
BoxLogType so you assert both behaviors: (1) the non-ANSI output from stdout
after the first collectOutput has no '\x1B[' and matches the plain boxed string,
and (2) the ANSI-enabled output from a second collectOutput contains ANSI
sequences and still renders with the same box width (e.g., verify it contains
'\x1B[' and, after stripping ANSI codes, equals the same boxed string). Target
the test, collectOutput, logger.warning and BoxLogType identifiers when making
the change.

---

Nitpick comments:
In `@packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart`:
- Around line 247-249: The _stripAnsiCodes function currently only removes SGR
color sequences and should either be renamed to reflect that limitation or
expanded to strip all common ANSI control sequences; update _stripAnsiCodes to
remove not just SGR ("\x1B[...m") but also CSI sequences ending with bytes in
the range `@-`~, OSC sequences (ESC ] ... BEL or ESC \ terminators),
single-character escapes (ESC followed by control byte), and other ESC sequences
so terminal control codes no longer contribute to visible width, then run/update
any tests or callers that depend on box alignment to validate the fix.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 47eafb58-0bdb-46d3-89e2-923a58ecf105

📥 Commits

Reviewing files that changed from the base of the PR and between 56df24b and a479bc3.

📒 Files selected for processing (2)
  • packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart
  • packages/cli_tools/test/std_out_logger_test.dart

Comment thread packages/cli_tools/test/std_out_logger_test.dart
@SergioChan
Copy link
Copy Markdown
Author

Thanks for the additional review.

I pushed a follow-up commit to address ANSI-stripping robustness in boxed logs:

  • Expanded _stripAnsiCodes to remove broader ANSI/VT control sequences (not just SGR ...m), including CSI and OSC forms.
  • Added a regression test covering non-SGR sequences (OSC hyperlink + cursor/control CSI) to ensure box width is calculated from visible text only.

Validation:

  • I attempted to run dart test packages/cli_tools/test/std_out_logger_test.dart, but dart is not available in this environment (dart: command not found).
  • The change is scoped to logger ANSI stripping + targeted tests.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/cli_tools/test/std_out_logger_test.dart (1)

160-199: ⚠️ Potential issue | 🟠 Major

Exercise the ANSI-enabled branch in these box tests.

These cases currently require stdout.output to contain no escape sequences, so they only validate the non-ANSI path. The bug fixed in this PR is on the ANSI-enabled path, where the box is restyled after formatting, so that regression could come back without failing these tests. Add an ANSI-enabled assertion and compare the de-ANSI'd output to the same expected box.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli_tools/test/std_out_logger_test.dart` around lines 160 - 199, The
tests currently only assert the non-ANSI path; to exercise the ANSI-enabled
branch capture the raw output from collectOutput when calling logger.warning
(with BoxLogType) and first assert that stdout.output contains ANSI escape
sequences (e.g., contains '\x1B[' or other control sequences), then strip
ANSI/control sequences from that raw output and compare the stripped result to
the same expected boxed string used currently; update both test cases that use
collectOutput/logger.warning/BoxLogType to include this additional assertion so
the ANSI-enabled branch is exercised and the de-ANSI'd output equals the
expected box.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@packages/cli_tools/test/std_out_logger_test.dart`:
- Around line 160-199: The tests currently only assert the non-ANSI path; to
exercise the ANSI-enabled branch capture the raw output from collectOutput when
calling logger.warning (with BoxLogType) and first assert that stdout.output
contains ANSI escape sequences (e.g., contains '\x1B[' or other control
sequences), then strip ANSI/control sequences from that raw output and compare
the stripped result to the same expected boxed string used currently; update
both test cases that use collectOutput/logger.warning/BoxLogType to include this
additional assertion so the ANSI-enabled branch is exercised and the de-ANSI'd
output equals the expected box.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 99dfbba5-15cf-4456-b3bb-59a174d46dd0

📥 Commits

Reviewing files that changed from the base of the PR and between a479bc3 and 99ab33e.

📒 Files selected for processing (2)
  • packages/cli_tools/lib/src/logger/loggers/std_out_logger.dart
  • packages/cli_tools/test/std_out_logger_test.dart

Comment on lines 154 to +160
message = _formatAsBox(
wrapColumn: wrapTextColumn ?? _defaultColumnWrap,
message: message,
title: type.title,
message: _stripAnsiCodes(message),
title: type.title != null ? _stripAnsiCodes(type.title!) : null,
);
if (ansiSupported) {
message = _styleByLevel(message, logLevel);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Don't drop caller-supplied ANSI styling from boxed logs.

Lines 156-160 build the box from stripped message/title and only reapply _styleByLevel afterward. That removes any inline styling the caller passed in, and LogLevel.info / LogLevel.nothing boxes become plain text on ANSI-capable terminals. Use stripped text for width calculation only; the final render should preserve the original styled content.

@SergioChan
Copy link
Copy Markdown
Author

Thanks — addressed the latest ANSI-path test feedback.

What I changed

  • Updated test harness to allow stdout.supportsAnsiEscapes to be toggled in tests (collectOutput(..., ansiSupported: true)).
  • Updated both BoxLogType regression tests to run with ANSI enabled.
  • Added assertions that raw output contains ANSI escape sequences, then strip ANSI/control sequences and assert the de-ANSI output matches the expected box rendering.

Commit

  • 94e69c0test(logger): exercise ANSI-enabled box rendering path

Validation

  • I could not run dart test here because the dart CLI is unavailable in this environment (dart: command not found).
  • Changes are test-scoped except for the test utility toggle needed to simulate ANSI-capable stdout.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/cli_tools/test/std_out_logger_test.dart (1)

171-174: Extract the duplicated ANSI-stripping helper.

Lines 171-174 and 198-201 repeat the same large regex. A local helper would make these tests easier to read and keep the normalization logic in one place.

Refactor sketch
-      final stripped = stdout.output.replaceAll(
-        RegExp(r'\x1B\[[0-?]*[ -/]*[`@-`~]|\x1B\][^\x07\x1B]*(?:\x07|\x1B\\\\)|\x1B[`@-Z`\\\\-_]'),
-        '',
-      );
+      final stripped = _stripAnsi(stdout.output);
...
-      final stripped = stdout.output.replaceAll(
-        RegExp(r'\x1B\[[0-?]*[ -/]*[`@-`~]|\x1B\][^\x07\x1B]*(?:\x07|\x1B\\\\)|\x1B[`@-Z`\\\\-_]'),
-        '',
-      );
+      final stripped = _stripAnsi(stdout.output);
final _ansiRegex = RegExp(
  r'\x1B\[[0-?]*[ -/]*[`@-`~]|\x1B\][^\x07\x1B]*(?:\x07|\x1B\\\\)|\x1B[`@-Z`\\\\-_]',
);

String _stripAnsi(final String input) => input.replaceAll(_ansiRegex, '');

Also applies to: 198-201

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli_tools/test/std_out_logger_test.dart` around lines 171 - 174,
Extract the duplicated ANSI-stripping regex into a shared RegExp (e.g. final
_ansiRegex = RegExp(r'\x1B\[[0-?]*[
-/]*[`@-`~]|\x1B\][^\x07\x1B]*(?:\x07|\x1B\\\\)|\x1B[`@-Z`\\\\-_]',);) and add a
helper String _stripAnsi(String input) => input.replaceAll(_ansiRegex, ''); then
replace the two inline replaceAll(RegExp(...), '') usages (the ones operating on
stdout.output) with calls to _stripAnsi(stdout.output) so the normalization
logic is centralized and the tests are clearer.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/cli_tools/test/test_utils/io_helper.dart`:
- Around line 12-15: The stderr MockStdout isn't receiving the ansiSupported
flag, so collectOutput(..., ansiSupported: true) still yields
supportsAnsiEscapes == false on standardError; update the creation of
standardError (in the collectOutput helper) to pass ansiSupported: ansiSupported
(same as standardOut) so both MockStdout instances reflect the requested ANSI
capability and allow exercising ANSI-capable stderr paths like
logToStderrLevelThreshold.

---

Nitpick comments:
In `@packages/cli_tools/test/std_out_logger_test.dart`:
- Around line 171-174: Extract the duplicated ANSI-stripping regex into a shared
RegExp (e.g. final _ansiRegex = RegExp(r'\x1B\[[0-?]*[
-/]*[`@-`~]|\x1B\][^\x07\x1B]*(?:\x07|\x1B\\\\)|\x1B[`@-Z`\\\\-_]',);) and add a
helper String _stripAnsi(String input) => input.replaceAll(_ansiRegex, ''); then
replace the two inline replaceAll(RegExp(...), '') usages (the ones operating on
stdout.output) with calls to _stripAnsi(stdout.output) so the normalization
logic is centralized and the tests are clearer.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4ffe7b0b-95bd-427e-8543-da946ba95cd4

📥 Commits

Reviewing files that changed from the base of the PR and between 99ab33e and 94e69c0.

📒 Files selected for processing (3)
  • packages/cli_tools/test/std_out_logger_test.dart
  • packages/cli_tools/test/test_utils/io_helper.dart
  • packages/cli_tools/test/test_utils/mock_stdout.dart

Comment thread packages/cli_tools/test/test_utils/io_helper.dart Outdated
@SergioChan
Copy link
Copy Markdown
Author

Thanks — addressed the latest review notes with a small follow-up commit.

Updates pushed

  • Propagated ansiSupported to standardError in collectOutput(...) so both mocked streams reflect ANSI capability when enabled.
  • Extracted the duplicated ANSI-normalization regex in std_out_logger_test.dart into a shared _ansiRegex + _stripAnsi(...) helper and reused it in both BoxLogType tests.

Commit

  • 120a5aetest(logger): propagate ansi flag to stderr and dedupe strip helper

Validation

  • I could not run dart test here because the dart CLI is unavailable in this environment (dart: command not found).
  • Change is scoped to test helpers/tests only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The BoxLogType renders non-info level messages with mismatching line lengths

2 participants