Skip to main content

How to use Plugins

info
What you'll learn​
  • How to install a plugin
  • How to use a plugin

Cypress maintains a curated list of plugins created by us and the community. Plugins from our official list are npm modules. This enables them to be versioned and updated separately without needing to update Cypress itself.

You can install any published plugin using npm:

npm install <plugin name> --save-dev

Using a plugin​

Add your plugin to the setupNodeEvents function in the Cypress configuration. Please follow any additional instructions provided by the plugin's documentation. Here's an example of what this might look like:

const { defineConfig } = require('cypress')

module.exports = defineConfig({
// setupNodeEvents can be defined in either
// the e2e or component configuration
e2e: {
setupNodeEvents(on, config) {
// bind to the event we care about
on('<event>', (arg1, arg2) => {
// plugin stuff here
})
},
},
})

For information on writing plugins, please check out our Node Events Overview.