Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cypress-log

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-log

Custom Cypress command that overrides the default cy.log() command and adds the ability to log to the terminal and the Command Log.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

cypress-log

Intelligible package that overrides the default behavior of the cy.log() method by giving the ability to print whatever you want not only in Cypress Runner UI but in the terminal as well. This is super useful when you don't want to handle what to invoke a built-in command or a task, but you still want to use one command for logging everything everywhere.

Install

npm install -D cypress-log

Usage

In your cypress/support/e2e.js file, add the following:

import 'cypress-log';

Also, you need to add the following to your cypress.config.js file:

// import the log function
const { log } = require('cypress-log/log.task');

module.exports = {
  // ...
  e2e: {
    setupNodeEvents(on, config) {
      // add the function to the task
      on('task', { log });
    },
  },
  // ...
};

Then, you can use the cy.log command in your tests as you've used to do it before. The only difference is that you can any data type as an argument. For example:

cy.log('Hello, World!');
cy.log({ foo: 'bar', baz: { nested: 'prop' } });
cy.log(['foo', 'bar']);
cy.log('another message', ['one', 'two', 'three'], { foo: 'foo' });

So, if you run your tests in the Cypress Runner UI, you will see the following:

ui

and if you run your tests in non-interactive mode, you will see the following in the terminal:

terminal

Author

Yevhen Laichenkov elaichenkov@gmail.com

License

MIT

Keywords

FAQs

Package last updated on 21 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc