Is it possible to redirect or capture Cypress browser log and command log to output?
I read some Cypress github issues on this topic. But I don\'t know how to make
Expanding on @Joshua-wade's answer, you can overwrite cy.log
to redirect all calls to it to the log task. Just as the following:
Cypress.Commands.overwrite('log', (subject, message) => cy.task('log', message));
Note: there's a small drawback to this: when you run the test using the Test Runner, instead of seeing LOG my message
in the command log, you'll see TASK log, my message
. But IMHO it's negligible.