Socket
Socket
Sign inDemoInstall

retry-limiter

Package Overview
Dependencies
Maintainers
7
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retry-limiter - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

12

gemini.js

@@ -15,3 +15,4 @@ 'use strict';

const configDecorator = ConfigDecorator.create(gemini.config);
const retryRuleAfterLimit = (data) => typeof data.equal === 'undefined' && data.retriesLeft > 0;
const configDecorator = ConfigDecorator.create(gemini.config, retryRuleAfterLimit);

@@ -23,3 +24,10 @@ let retryLimiter;

});
gemini.on(gemini.events.RETRY, () => retryLimiter.exceedLimit() && configDecorator.disableRetries());
gemini.on(gemini.events.RETRY, function retryCallback() {
if (!retryLimiter.exceedLimit()) {
return;
}
configDecorator.disableRetries();
gemini.removeListener(gemini.events.RETRY, retryCallback);
});
};

@@ -26,0 +34,0 @@

@@ -14,3 +14,4 @@ 'use strict';

const configDecorator = ConfigDecorator.create(hermione.config);
const retryRuleAfterLimit = () => false;
const configDecorator = ConfigDecorator.create(hermione.config, retryRuleAfterLimit);

@@ -31,3 +32,10 @@ let retryLimiter;

});
hermione.on(hermione.events.RETRY, () => retryLimiter.exceedLimit() && configDecorator.disableRetries());
hermione.on(hermione.events.RETRY, function retryCallback() {
if (!retryLimiter.exceedLimit()) {
return;
}
configDecorator.disableRetries();
hermione.removeListener(hermione.events.RETRY, retryCallback);
});
};

9

lib/config-decorator.js
'use strict';
module.exports = class ConfigDecorator {
static create(config) {
return new ConfigDecorator(config);
static create(config, retryRule) {
return new ConfigDecorator(config, retryRule);
}
constructor(config) {
constructor(config, retryRule) {
this._config = config;
this._retryRule = retryRule;
}

@@ -14,5 +15,5 @@

this._config.getBrowserIds().forEach((browserId) => {
this._config.forBrowser(browserId).retry = 0;
this._config.forBrowser(browserId).shouldRetry = this._retryRule;
});
}
};
{
"name": "retry-limiter",
"version": "2.0.1",
"version": "2.0.2",
"description": "Plugin for gemini and hermione to disable retries at runtime",

@@ -5,0 +5,0 @@ "scripts": {

@@ -5,2 +5,10 @@ # retry-limiter [![Build Status](https://travis-ci.org/gemini-testing/retry-limiter.svg?branch=master)](https://travis-ci.org/gemini-testing/retry-limiter)

## How it works?
Plugin sets retries threshold. If it’s exceeded test will or will not be retried based on the result of `shouldRetry` function in config.
For Gemini the rule is: if the test ends without result (nor `equal:false` nor `equal:true`) test will be retried if it’s attempts not exceeded.
For Hermione the rule is: no retries.
## Install

@@ -14,3 +22,3 @@

### configuration
### Configuration

@@ -20,3 +28,3 @@ * **enabled** (optional) `Boolean` – enable/disable the plugin; default `true`.

### gemini
### Gemini

@@ -37,3 +45,3 @@ Add the plugin to your configuration file:

### hermione
### Hermione

@@ -40,0 +48,0 @@ ```js

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