npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cypress-log-filter

v1.0.5

Published

Filter Cypress logs

Downloads

21,631

Readme

Cypress Log Filter Plugin

Node.js Package npm Static Badge

The Cypress Log Filter Plugin is a plugin for Cypress that allows you to filter logs based on different log levels. This plugin provides a convenient way to control the log output during your Cypress test runs.

Cypress Log Filtering Limitations

By default, Cypress does not provide built-in log filtering capabilities. It only allows you to hide all logs entirely, which would also hide any errors. This limitation can make it challenging to focus on specific log levels or troubleshoot issues effectively.

To mitigate this limitation, the Cypress Log Filter Plugin enhances Cypress with the ability to filter logs based on different log levels, providing more flexibility and control over the log output during your tests and reducing the memory consumption when a test executes lot of commands.

If you prefer to disable the command log completely, refer to the official Cypress documentation on Disabling the Command Log.

Installation

To install this plugin, you can use either npm or yarn:

npm install cypress-log-filter --save-dev

or

yarn add cypress-log-filter --dev

Then, import the plugin in your support/e2e.js file

require("cypress-log-filter");

Configuration

Setting the Log Level in cypress.config.ts

You can configure the log level by adding a logLevel property to your cypress.config.ts configuration file:

e2e: {
  env: {
    logLevel: "VERBOSE"
    ...
  }
  ...
},

The available log levels are:

  • VERBOSE (Default): Shows all logs, including verbose, info, assert, and error.
  • INFO: Shows cy.logs messages, assert, and error logs.
  • ASSERT: Shows assert and error logs.
  • ERROR: Shows only error logs.

Setting the Log Level via Environment Variable

Alternatively, you can set the log level as an environment variable named CYPRESS_LOG_LEVEL. When Cypress runs, it will read this environment variable and apply the specified log level.

CYPRESS_LOG_LEVEL=INFO npx cypress run

Usage

Once the plugin is installed and the log level is configured, the log output will be filtered accordingly. Only logs with the specified log level and higher will be displayed in the Cypress test runner.

For example, if the log level is set to INFO, all logs of level INFO, ASSERT, and ERROR will be shown. VERBOSE level logs will be hidden.

Modifying Log Level in Cypress Test Runner

When running Cypress with npx cypress open, the Cypress Log Filter Plugin adds a dropdown menu to the interface. This dropdown menu allows you to modify the log level on the fly while interacting with your tests.

Example

Contributing

Contributions are more than welcome! If you find any issues or have suggestions for improvements, please open an issue or directly submit a pull request and I'll try to review it ASAP.


Thank you for using my first Cypress plugin. If you have any questions or need further assistance, please feel free to reach out.