How to save the console log in Cypress rather than letting it display in the terminal?

I have used this code:

const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = (on, config) => {
  on('file:preprocessor', cucumber())

  on(`task`, {
    log(message) {
      console.log("x1b[31m", "LOG:", message, "x1b[0m")
    info(message) {"x1b[33m", "INFO:", message, "x1b[0m")

and also this:

Cypress.on('window:before:load', win => {
  cy.stub(win.console, 'log', msg => {"task", "log", msg)

  cy.stub(win.console, 'info', msg => {"task", "info", msg)

It is showing my console in the terminal, however, I want to save the terminal log so that I can see all the console log.

Can anyone help?

Stack Overflow Asked by Tester1 on February 21, 2021

0 Answers

Add your own answers!

Related Questions

What will this recursive function yield?

1  Asked on December 9, 2021 by user13812739


How to style Rebass Switch

5  Asked on December 9, 2021 by amaster


Redis Cluster Mode – replicas not working

1  Asked on December 9, 2021 by ramprakash


Disable seeking in mediaelement.js

1  Asked on December 9, 2021 by pelirrojo


Table not getting created sqlite android

4  Asked on December 9, 2021 by user3844417


Angularjs using JWT breaks CORS to Amazon S3 on login

2  Asked on December 9, 2021 by codephobia


Write a value with opc ua Python

2  Asked on December 9, 2021


unable to install vue chart.js in vue

2  Asked on December 9, 2021 by prabina-sht


Ask a Question

Get help from others!

© 2022 All rights reserved.