cy.log()
prints grey text to the left column:
cy.log()
takes an option for formatting, e.g. color, bold:
cy.log('Given I am logged in', { color: 'blue' })
N/A
3.x
maybe you can use this
console.log('%c Given I am logged in', 'color: blue;')
The driver code for the log command is located here: https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/commands/misc.coffee#L14
But the server and reporter packages would both need to be updated to understand how to interpret this and display this as a properly formatted color.
I would not expect this work to get in anytime soon, just by comparing the value added with the work required to implement, unless we do see a large amount of requests for this.
Fair enough! It's just a nice-to-have :smiley: thanks for your quick response, and thanks for the great product!
You can use markdown in the cy.log
message and it will be formatted. It looks like we don't have this documented, so I've created an issue.
While you can't specify a color for the text, if you want blue text at least, you can trick it by making the message a link :)
cy.log('normal')
cy.log('**bold**')
cy.log('_italic_')
cy.log('[blue](http://example.com)')
That's pretty neat - thanks!
It would be great to have similar functionality in the describe code.
I just wanted to apply color other than the Bule and not to link. I just wanted to apply in normal text. Please do advice.
Yes would be so great can change the text and background color
bump
I sometimes work around the problem of quickly finding certain lines by adding 馃崌emojis to the start of certain 馃攽messages to make them stand out.
Most helpful comment
You can use markdown in the
cy.log
message and it will be formatted. It looks like we don't have this documented, so I've created an issue.While you can't specify a color for the text, if you want blue text at least, you can trick it by making the message a link :)