cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.49k stars 3.15k forks source link

Whitespace formatting regression issue in error messages #29818

Open joaopslins opened 2 weeks ago

joaopslins commented 2 weeks ago

Current behavior

I'm using @testing-library/cypress as a demonstration since it's the library I use in my project, so I'm not sure if this is a Cypress issue or @testing-library issue.

Seems like around version 13.6.3, the formatting whitespace in error messages disappeared, so all code has no indentation anymore. Behavior is the same in the latest version 13.13.0.

It gets really hard to read when rendering the DOM (see attached video)

image

https://github.com/cypress-io/cypress/assets/15643533/eb03a3e6-e4ad-437a-a8b2-26fb1b7a390e

Desired behavior

From 13.6.2 (which was an improvement compared to 13.6.1).

The indentation is better but there's too many line breaks still (this might be @testing-library issue).

image

https://github.com/cypress-io/cypress/assets/15643533/f28f56e4-f0c5-42ba-b4a5-e4fcb67280d7

Test code to reproduce

I have a repro repo here: https://github.com/joaopslins/cypress-testing-library-format-repro

Cypress Version

13.6.3

Node version

v20.10.0

Operating System

macOS 14

Debug Logs

No response

Other

No response

jennifer-shehane commented 2 weeks ago

I'm sure it had to do with this update: https://github.com/cypress-io/cypress/pull/28583

We're open to a PR to address this.