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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cypress-retry-after-run

v1.0.7

Published

Cypress plugin to re-run only failed tests from the previous run using @cypress/grep

Readme

cypress-retry-after-run

A Cypress plugin that enables you to retry only the failed tests from a previous run.

In standard Cypress retries, tests are retried immediately within the same execution. However, sometimes you want to run the entire suite first, capture failures, and then trigger a separate execution that only runs those specific failed tests (maybe to deploy a fresh new data from an environment or do something else before retrying the failed tests).

How it works

  1. Records Failures: The plugin listens to your test run and saves a list of failed tests to a .cypress-failures.json file.
  2. Smart Retry: The included CLI command reads this file and launches Cypress again, using @cypress/grep to filter and run only the tests that failed previously.

This is particularly useful in CI/CD pipelines to save time and resources by avoiding re-execution of passing tests.

Plugin Usage

1. Installation

npm install --save-dev cypress-retry-after-run @cypress/grep
# OR
yarn add -D cypress-retry-after-run @cypress/grep

2. Configuration (cypress.config.js)

You need to register the plugin in your setupNodeEvents function.

const { defineConfig } = require('cypress');

module.exports = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      // 1. Load @cypress/grep (Required)
      // Note: As of @cypress/grep v5+, use .plugin()
      require('@cypress/grep/plugin').plugin(config);

      // 2. Load cypress-retry-after-run
      // This will record failed tests to .cypress-failures.json
      require('cypress-retry-after-run')(on, config);

      return config;
    },
  },
});

3. Support File (cypress/support/e2e.js)

Ensure @cypress/grep is initialized in your support file.

const cypressGrep = require('@cypress/grep');
cypressGrep.register();

TypeScript Usage

If you are using TypeScript (cypress.config.ts), the setup is similar but using import syntax.

cypress.config.ts

import { defineConfig } from 'cypress';
import { plugin as grepPlugin } from '@cypress/grep/plugin';
import cypressRetry from 'cypress-retry-after-run';

export default defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      // 1. Load @cypress/grep
      grepPlugin(config);

      // 2. Load cypress-retry-after-run
      cypressRetry(on, config);

      return config;
    },
  },
});

cypress/support/e2e.ts

import { register } from '@cypress/grep';
register();

If you are using TypeScript, it is also recommended to add the following or something similar to your tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "es5",
      "dom"
    ],
    "types": [
      "cypress",
      "node"
    ],
    "esModuleInterop": true,
    "moduleResolution": "bundler",
    "module": "esnext"
  },
  "include": [
    "**/*.ts"
  ]
}

4. Run Retry

Run your tests as usual. If some tests fail, use the retry command to re-run only the failed ones.

# Via npm script (add "retry": "cypress-retry" to package.json) if you want
npm run retry

# OR directly with npx/yarn
npx cypress-retry
yarn cypress-retry