Cy.log args are no longer printed to the console showing newlines after cypress 7.2
See original GitHub issueCurrent behavior
cy.log
shows args as an array and doesn’t show the newlines that may be present. This make it very difficult to read large debug messages (something my QA users have come to depend on when debugging tests).
Desired behavior
cy.log
entries when clicked are printed to the developer console showing newlines. This is helpful if you have large debug logs you wish to view. This is how it used to work in 7.2 and prior.
Test code to reproduce
"cypress": "7.2.0", <=== shows newlines in console logs
...
"cypress": "7.3.0", <=== behavior changed
it('cy.log works', () => {
cy.log("Hello there from javascript", "this is not an array\nlarge logs with lots of lines\n\nmore logging\n\neven more")
})
Cypress Version
7.3+
Other
Cypress 7.2 and earlier:
Cypress 7.3 and later:
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
log - Cypress Documentation
Accepts a Markdown formatted message. args... Additional arguments to be printed to the Cypress Command Log. There is no limit to the number...
Read more >archfz/cypress-terminal-report - GitHub
Plugin for cypress that adds better terminal output for easier debugging. Prints cy commands, browser console logs, cy.request and cy.intercept data.
Read more >Why cy.log Prints Nothing - Gleb Bahmutov
Why cy.log command prints null or undefined even if the variable is set by the Cypress test. This is a very common question...
Read more >Cypress - print both on console AND on log file - Windows
According to other users this should solve your problem: custom command: Cypress.Commands.overwrite('log', (subject, message) => cy.task('log', ...
Read more >How to use Cypress cy.log command to output ... - YouTube
... to quickly dump some info into the Cypress Command Log. If needed, we can use `.then(JSON.stringify).then( cy. log )` to print larger......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@westhomas I tried your solution, but it makes the output look unintuitive when there are 2+ args like below:
It’s hard to guess what
0
,1
means at a glance.So, I changed it this way:
Released in
8.4.0
.This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v8.4.0, please open a new issue.