New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

cypress-backoff

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-backoff

Apply different timeouts to retried tests

latest
Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

cypress-backoff

npm

Convience library to apply different timeout strategies to retried tests. Inspired by Filip Hric.

This repository is not maintained by the Cypress developers.

Installation & usage

  • Install the module.

    npm install cypress-backoff
    
  • Add the retries to cypress.config.js.

    ...
    module.exports = defineConfig({
        retries: 5,
    ...
    
  • Import the module

    const backoff = require('cypress-backoff')
    
  • Add your preferred timeout and strategy in the beforeEach block of your test

    beforeEach(() => {
        backoff.linear(1000)
    }
    

Available strategies

linear

Provide the desired timeout increase in milliseconds.

The timeout will increase with this number for every next attempt, i.e. 1000, 2000, 3000...

backoff.linear(1000)

exponential

Provide the desired timeout in milliseconds and exponential rate as an integer.

The timeout will be calculated as $T = timeout * exponentialrate^r$

backoff.exponential(1000, 2)

fixed

Provide an array with the desired timeout for each subsequent retry. If you allow more retries than elements specified the last element will be used.

backoff.fixed([1000, 2000, 3000])

fibonacci

Provide the desired timeout which will be multiplied by the fibonacci number of the retry.

backoff.fibonacci(1000)

custom

Provide a custom function that accepts the retry count as a parameter and returns the desired timeout.

backoff.custom((retryCount) => {return retryCount*2000})

JSDoc function documentation

The documentation of each of the functions can be found here.

FAQs

Package last updated on 18 May 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