Formatted errors does not show as formatted in cypress test runner
See original GitHub issueCurrent behavior
Cypress 10 new test runner omits formatting on errors such as new lines, tabs, etc.
Desired behavior
To be able to throw an error with formattings such as new lines, and tabs. For example see how cypress dashboard prints the error below
Test code to reproduce
it.only('fail to format in test runner', { retries: 0 }, () => {
Cypress.on('fail', (error, runnable) => {
throw {
...error,
message: `Failed to assert event.\n\nExpectedValue:**${JSON.stringify(
error.expected,
null,
4
)}** \nActual args: **${JSON.stringify(error.actual, null, 4)}** \n
`,
};
});
cy.wrap({
category: 'resources',
name: 'action',
label: 'copy_clipboard',
target: 'keyboard',
location: {
title: 'favorites',
},
search: {
clientSearchId: 'favorites',
sessionId: 'favorites',
},
resources: {
message: 'match(undefined)',
},
jsonData: {
'action.trigger': 'command_bar',
},
}).should('deep.equal', {
category: 'resources',
name: 'action',
target: 'keyboard',
label: 'copy_clipboard',
location: {
title: 'favorites',
},
resources: [
{
id: 'UgfdGiIVw7NklNbHWSO-fw',
list: 'favorites',
appId: 'mockapp',
type: 'mockapp:item',
position: 0,
linkId: '631483cead6377c7a8ef5c2e',
},
],
jsonData: {
'action.trigger': 'command_bar',
},
});
});
Cypress Version
10.7.0
Node version
16.14.2
Operating System
windows 10
Debug Logs
No response
Other
- It worked well with cypress 9 and was broken with Cypress 10.
- it actually works well in Cypress dashboard.
Cypress Dashboard showing formatted error
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Best Practices - Cypress Documentation
Real World Practices The Cypress team maintains the Real World App (RWA), a full stack example application that demonstrates best practices and scalable....
Read more >javascript - Cypress after each starts before test - Stack Overflow
I'm creating a cypress test suite, if I run one test all the hooks work correctly, ... For instructions on formatting see How...
Read more >Unit test reports - GitLab Docs
If you don't use merge requests but still want to see the unit test report output ... First, GitLab Runner uploads all JUnit...
Read more >Continuous Integration - cypress - w3resource
Finally, we will show you how to run tests in parallel on a CI. Setting up CI. Basics. Running Cypress in Continuous Integration...
Read more >Install - Prettier
prettier --write . is great for formatting everything, but for a big project it ... "app/**/*.test.js" to format all tests in a directory...
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
Hi, yeah… you can take it if you want
Thank you, I will give it a try this weekend