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-plugin-retries

v1.5.2

Published

Cypress plugin allowing tests to retry a configurable amount of times

Downloads

24,338

Readme

Please report bugs in the issues of this repo.

Please refer to this issue for updates about official cypress retry support

Installation

Add the plugin to devDependencies

npm install -D cypress-plugin-retries

At the top of cypress/support/index.js:

require('cypress-plugin-retries')

Optional Installation

To enable retry logging in the terminal alongside mocha output
Inside cypress/plugins/index.js:

module.exports = (on, config) => {
  require('cypress-plugin-retries/lib/plugin')(on)
}

example output:

Usage

Use the environment variable CYPRESS_RETRIES to set the retry number for all spec files:

CYPRESS_RETRIES=2 npm run cypress

or Set the "env" key in your cypress.json configuration file to set the retry number for all spec files:

{
  "env":
  {
    "RETRIES": 2
  }
}

or On a per-test or per-hook basis, set the retry number:

Note: this plugin adds Cypress.currentTest and you should only access it in the context of this plugin.

it('test', () => {
    Cypress.currentTest.retries(2)
})

or [undesirable] Use mocha's this.retries(n) inside of a test:

Note: must use function() notation, not arrows ()=>{}

it('test', function() {
    this.retries(2)
})

FAQ

Conditional Logic based on currentRetry number? https://github.com/Bkucera/cypress-plugin-retries/issues/32

How it works

  • a test with retries enabled will immediately retry on failure instead of moving on to the next test.
  • tests only retry on failure. If all your tests pass on the first try, it's as if you didn't have this plugin.
  • during a retry, all beforeEach and afterEach hooks that apply the test will be re-ran
  • beforeAll(before) hooks are not re-ran on retry. These are guaranteeed only to be ran once.
  • if a test fails in a beforeEach hook, the test will retry
  • if a test fails in a afterEach/afterAll hook, the test will not retry, but fail as normal (if you want to retry an afterEach hook, see this issue)
  • only the final run of a test will be sent to the mocha reporter/Dashboard. This means if a test passes on the second retry, you'll see one passing test.
  • a screenshot is taken on each test retry. This can be configured as detailed here: https://docs.cypress.io/api/commands/screenshot.html#Test-Failures
  • commands from past test tries will be faded out, as shown in the screenshot above

Extra Configuration

  • Use env var RETRIES_HIDDEN=1 to hide previous attempts' command log entries (instead of marking them with an orange x)
  • Use env var RETRIES_NO_LOG=1 to omit logging to terminal in Cypress run mode ((retry 1/3) ...)

License

MIT