Skip to content

Conversation

@MikeMcC399
Copy link
Contributor

@MikeMcC399 MikeMcC399 commented Jan 26, 2026

Additional details

The log header when Cypress is run, shows the Node Version with path.

In the CI environment of GitHub Actions runners, the paths are longer than on a typical non-CI installation:

Runner Path
macos-15 /Users/runner/actions-runner/cached/externals/node24/bin/node
ubuntu-24.04 /home/runner/actions-runner/cached/externals/node24/bin/node
windows-2025 C:\actions-runner\cached\externals\node24\bin\node.exe

This results in characters from ANSI escape code sequences being visibly printed to the logs for macos-15 and ubuntu-24.04

macos-15

  │ Node Version:   v24.12.0 (/Users/runner/actions-runner/cached/externals/node24/bin/node)       │
  │                 [39m                                                                           │

ubuntu-24.04

  │ Node Version:   v24.12.0 (/home/runner/actions-runner/cached/externals/node24/bin/node)[0m       │
  │                 39m                                                                            │

The shorter path encountered on windows-2025 does not suffer from this issue, and the path is rendered correctly in the log header.

The packages/server/lib/util/newlines.js utility is enhanced so that it correctly deals with strings containing ANSI escape sequences, such as created by the chalk package, to set text as gray.

Before checking if a newline is needed, the string to be printed is stripped of any (non-printable) ANSI escape sequences.

If the string then needs wrapping with a newline, the string is returned wrapped without the ANSI escape sequences. This is necessary because in the Cypress run log header, the string is embedded in a table and even if the newline character (\n) is added to the string without overwriting an ANSI escape sequence, only the first line of the string would be displayed as desired. Following lines have had their color status separately reset.

This resolves the issue #32736 for GitHub Actions, since the Node.js paths can be displayed in the table within the available space. They were however getting incorrectly wrapped because newlines.js was counting the non-printing characters of the ANSI escape sequences as printing characters.


Note

Low Risk
Low risk: small, localized change to a string-wrapping utility used in run header formatting, plus added unit coverage; main risk is minor output formatting differences for ANSI-colored paths.

Overview
Fixes log header wrapping when values include ANSI escape sequences (e.g. colored Node.js paths in CI). addNewlineAtEveryNChar now strips VT control characters for length calculation, returning the original string when no wrapping is needed but dropping ANSI codes when wrapping occurs to avoid broken table output.

Updates unit tests to cover non-wrapping cases and ANSI-colored inputs, and records the user-facing fix in the CLI changelog.

Written by Cursor Bugbot for commit 0efbd03. This will update automatically on new commits. Configure here.

Steps to test

On Windows 11 install Node.js 22.19.0 https://nodejs.org/dist/v22.19.0/node-v22.19.0-x64.msi to C:\Program Files\home-runner-actions-runner-cachedD\ to simulate the Ubuntu path length /home/runner/actions-runner/cached/externals/node24/bin/node, since node.exe is added to the original path.

git clone --branch 32736-ansi-escape https://github.com/MikeMcC399/cypress-test-tiny
cd cypress-test-tiny
npm ci
npx cypress run # note 39m character incorrectly displayed
cd ..

npm install yarn@latest -g
git clone --branch issue-32736-newlines-ansi https://github.com/MikeMcC399/cypress
cd cypress
yarn
cd packages/server
yarn test-unit newlines_spec # unit test should pass
cd ../..
yarn cypress:run --project ../cypress-test-tiny # no printed ANSI escape characters in log header
image

How has the user experience changed?

Users of GitHub Actions with Ubuntu or macOS runners will no longer see printed ANSI escape characters in the log header in the Node Version line.

This may also affect other CI providers and could occur if Node.js is installed elsewhere with a longer path. When Node.js is installed locally and default locations are used, the issue would not occur.

PR Tasks

Handles strings containing ANSI escape code sequences
If printable string length is within allowed width, does not wrap
Converts strings to plain string without ANSI escape code sequences
when printable width exceeded, then wraps accordingly

Resolves issue displaying longer Node.js paths such as encountered on
GitHub Actions in Ubuntu and macOS runners
@cypress-app-bot
Copy link
Collaborator

@MikeMcC399

This comment was marked as outdated.

@cacieprins cacieprins self-requested a review January 27, 2026 17:35
@cacieprins cacieprins self-assigned this Jan 27, 2026
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.

Bad format for Node Version in summary on GitHub Actions

3 participants