Socket
Socket
Sign inDemoInstall

cypress-plugin-retries

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-plugin-retries - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0

src/.eslintrc.json

58

package.json
{
"name": "cypress-plugin-retries",
"version": "1.2.2",
"version": "1.3.0",
"description": "Cypress plugin allowing tests to retry a configurable amount of times",
"main": "src",
"scripts": {
"test": "node test.js"
"lint": "eslint --ext json,js,ts .",
"test": "cypress run --spec '**/unit/**'",
"test-e2e": "mocha test/e2e"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"devDependencies": {
"@babel/code-frame": "^7.5.5",
"@cypress/eslint-plugin-dev": "^4.0.0",
"@types/fs-extra": "^8.0.0",
"@types/lodash": "^4.14.138",
"@typescript-eslint/eslint-plugin": "^2.2.0",
"@typescript-eslint/parser": "^2.2.0",
"bluebird": "^3.5.5",
"chai": "^4.2.0",
"chalk": "^2.4.2",
"cypress": "^3.4.1",
"debug": "^4.1.1",
"eslint": "^5.16.0",
"eslint-plugin-cypress": "^2.6.0",
"eslint-plugin-json-format": "^2.0.1",
"eslint-plugin-mocha": "^6.0.0",
"fast-glob": "^3.0.4",
"fs-extra": "^8.1.0",
"glob": "^7.1.4",
"husky": "^3.0.5",
"json5": "^2.1.0",
"lint-staged": "^9.2.5",
"lodash": "^4.17.15",
"mocha": "^6.2.0",
"semantic-release": "^15.13.24",
"strip-ansi": "^5.2.0",
"typescript": "^3.6.2"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/Bkucera/cypress-plugin-retries.git"
},
"author": "Ben Kucera",
"keywords": [

@@ -14,11 +55,8 @@ "cypress",

],
"repository": {
"type": "git",
"url": "git://github.com/Bkucera/cypress-plugin-retries.git"
},
"author": "Ben Kucera",
"license": "MIT",
"devDependencies": {
"cypress": "^3.1.5"
"lint-staged": {
"*.{js,jsx,ts,tsx,json,eslintrc}": [
"eslint --fix",
"git add"
]
}
}

2

README.md

@@ -7,3 +7,3 @@

<a href="https://www.npmjs.com/package/cypress-plugin-retries"><img src="https://img.shields.io/npm/v/cypress-plugin-retries.svg?style=flat"></a>
<a href="https://www.npmjs.com/package/cypress-plugin-retries"><img src="https://img.shields.io/npm/dt/cypress-plugin-retries.svg"></a>
<a href="https://www.npmjs.com/package/cypress-plugin-retries"><img src="https://img.shields.io/npm/dm/cypress-plugin-retries.svg"></a>
<a href="https://github.com/bkucera/cypress-plugin-retries/blob/master/LICENSE"><img src="https://img.shields.io/github/license/bkucera/cypress-plugin-retries.svg"></a>

@@ -10,0 +10,0 @@

@@ -11,2 +11,1 @@ /// <reference types="cypress" />

}

@@ -1,2 +0,1 @@

const _ = Cypress._
let logs = []

@@ -8,16 +7,28 @@

const getRetriesHidden = () => {
return Cypress.env('RETRIES_HIDDEN')
}
const debug = function () {
// console.log.apply(this, arguments)
}
const _clone = Cypress.mocha._mocha.Mocha.Test.prototype.clone
Cypress.mocha._mocha.Mocha.Test.prototype.clone = function() {
Cypress.mocha._mocha.Mocha.Test.prototype.clone = function () {
if (this.trueFn) {
this.fn = this.trueFn
}
const ret = _clone.apply(this, arguments)
ret.id = this.id
ret.err = null
debug('clone test')
logs.forEach(log => {
logs.forEach((log) => {
log.set({
state: log.get().state + ' ignored' + ' retry-' + ret._currentRetry
state: `${log.get().state} ignored retry-${ret._currentRetry}`,
})
})
logs = []

@@ -33,3 +44,4 @@

const _onRunnableRun = Cypress.runner.onRunnableRun
Cypress.runner.onRunnableRun = function(runnableRun, runnable, args) {
Cypress.runner.onRunnableRun = function (runnableRun, runnable, args) {
debug('_onRunnableRun')

@@ -39,5 +51,4 @@

const isHook = r.type === 'hook'
const isAfterHook = isHook && r.hookName.match(/after/)
const isAfterAllHook = isHook && r.hookName.match(/after all/)
const isBeforeHook = isHook && r.hookName.match(/before/)
const isBeforeHook = isHook && r.hookName.match(/before each/)
const test = r.ctx.currentTest || r

@@ -52,9 +63,2 @@

if (isAfterAllHook) {
if (test.state !== 'failed') {
test.err = null
test.state = 'passed'
}
}
debug('on:', r.title)

@@ -69,14 +73,17 @@

debug('already failed, skipping this hook')
return next.call(this)
}
debug('running')
const onNext = function(err) {
const onNext = function (err) {
debug(runnable.title, 'onNext')
const fail = function() {
const fail = function () {
return next.call(this, err)
}
const noFail = function() {
const noFail = function () {
test.err = null
return next.call(this)

@@ -92,10 +99,13 @@ }

test.trueFn = test.fn
test.fn = function() {
test.fn = function () {
throw err
}
return noFail()
}
}
return fail()
}
args[0] = onNext

@@ -106,8 +116,6 @@

const pluginError = (message) => {throw new Error(`[cypress-plugin-retries]: ${message}`)}
// const pluginError = (message) => {
// throw new Error(`[cypress-plugin-retries]: ${message}`)
// }
// Cypress.Commands.add('retries', (n) => {
// })
addGlobalStyle(/*css*/ `

@@ -132,3 +140,4 @@ .command-state-retry {

.command.ignored {
opacity: 0.3
opacity: 0.3;
${getRetriesHidden() ? 'display: none' : ''}
}

@@ -174,4 +183,5 @@ .command.ignored:hover {

function addGlobalStyle(css) {
var head, style
function addGlobalStyle (css) {
let head; let style
head = window.top.document.getElementsByTagName('head')[0]

@@ -181,2 +191,3 @@ if (!head) {

}
style = window.top.document.createElement('style')

@@ -188,18 +199,16 @@ style.type = 'text/css'

const debug = function() {
// console.log.apply(this, arguments)
}
Object.defineProperty(Cypress, 'currentTest', {
configurable: true,
get: function(){
get () {
const r = cy.state('runnable')
if (!r) {
const err = new Error()
err.message = 'Cypress.currentTest cannot be accessed outside a test or hook (it, before, after, beforeEach, afterEach)'
throw err
}
return r && r.ctx.currentTest || r
}
},
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc