Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ _Released 02/08/2026 (PENDING)_

- Fixed an issue on Windows where extracting the Studio or Prompt bundle could fail with `EPERM: operation not permitted` when renaming extracted files. The extract step now retries on EPERM/EACCES with a short delay to handle transient file locks. Addressed in [#33330](https://github.com/cypress-io/cypress/pull/33330).

**Misc:**

- The Node.js path is now displayed correctly in run log headers for typical GitHub Actions paths. ANSI escape sequences are no longer incorrectly displayed for longer Node.js paths. Addresses [#32736](https://github.com/cypress-io/cypress/issues/32736).

## 15.10.0

_Released 02/03/2026_
Expand Down
12 changes: 12 additions & 0 deletions packages/server/lib/util/newlines.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const util = require('util')

const addNewlineAtEveryNChar = (str, n) => {
if (!str) {
return str
Expand All @@ -6,6 +8,16 @@ const addNewlineAtEveryNChar = (str, n) => {
let result = []
let idx = 0

let printableString = util.stripVTControlCharacters(str)

if (printableString.length !== str.length) {
if (printableString.length <= n) {
return str
} else {
str = printableString
}
}

while (idx < str.length) {
result.push(str.slice(idx, idx += n))
}
Expand Down
30 changes: 24 additions & 6 deletions packages/server/test/unit/util/newlines_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,31 @@ import '../../spec_helper'
import newlines from '../../../lib/util/newlines'

describe('lib/util/newlines', function () {
it('inserts newline at each n char', function () {
expect(newlines.addNewlineAtEveryNChar('123456789', 3)).to.eq('123\n456\n789')
context('regular strings', function () {
it('inserts newline at each n char', function () {
expect(newlines.addNewlineAtEveryNChar('123456789', 3)).to.eq('123\n456\n789')
})

it('does not insert newline if str length <= n', function () {
expect(newlines.addNewlineAtEveryNChar('123', 3)).to.eq('123')
})

it('returns undefined if str not defined', function () {
expect(newlines.addNewlineAtEveryNChar(undefined, 3)).to.eq(undefined)
})
})
})

describe('lib/util/newlines', function () {
it('returns undefined if str not defined', function () {
expect(newlines.addNewlineAtEveryNChar(undefined, 3)).to.eq(undefined)
context('strings with ANSI codes', function () {
it('returns str unchanged if ANSI stripped length <= n', function () {
const shortAnsiString = '\u001B[31m123\u001B[39m' // "123" in red

expect(newlines.addNewlineAtEveryNChar(shortAnsiString, 3)).to.eq(shortAnsiString)
})

it('returns str with ANSI stripped if printing length > n', function () {
const longAnsiString = '\u001B[31m123456789\u001B[39m' // "123456789" in red

expect(newlines.addNewlineAtEveryNChar(longAnsiString, 3)).to.eq('123\n456\n789')
})
})
})