@webex/test-helper-retry 2.59.2 → 2.59.3-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +6 -6
- package/README.md +31 -31
- package/babel.config.js +3 -3
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +12 -11
- package/process +1 -1
- package/src/index.js +48 -48
package/.eslintrc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
root: true,
|
|
3
|
-
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
module.exports = config;
|
|
1
|
+
const config = {
|
|
2
|
+
root: true,
|
|
3
|
+
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
module.exports = config;
|
package/README.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
# @webex/test-helper-retry
|
|
2
|
-
|
|
3
|
-
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
-
|
|
5
|
-
>
|
|
6
|
-
|
|
7
|
-
- [Install](#install)
|
|
8
|
-
- [Usage](#usage)
|
|
9
|
-
- [Contribute](#contribute)
|
|
10
|
-
- [Maintainers](#maintainers)
|
|
11
|
-
- [License](#license)
|
|
12
|
-
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install --save @webex/test-helper-retry
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
## Maintainers
|
|
22
|
-
|
|
23
|
-
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
24
|
-
|
|
25
|
-
## Contribute
|
|
26
|
-
|
|
27
|
-
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
28
|
-
|
|
29
|
-
## License
|
|
30
|
-
|
|
31
|
-
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
|
1
|
+
# @webex/test-helper-retry
|
|
2
|
+
|
|
3
|
+
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
+
|
|
5
|
+
>
|
|
6
|
+
|
|
7
|
+
- [Install](#install)
|
|
8
|
+
- [Usage](#usage)
|
|
9
|
+
- [Contribute](#contribute)
|
|
10
|
+
- [Maintainers](#maintainers)
|
|
11
|
+
- [License](#license)
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install --save @webex/test-helper-retry
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
## Maintainers
|
|
22
|
+
|
|
23
|
+
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
24
|
+
|
|
25
|
+
## Contribute
|
|
26
|
+
|
|
27
|
+
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
package/babel.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = babelConfigLegacy;
|
|
1
|
+
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = babelConfigLegacy;
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
4
4
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
5
|
-
/*!
|
|
6
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
5
|
+
/*!
|
|
6
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/* eslint-disable max-nested-callbacks */
|
|
@@ -15,9 +15,9 @@ if (typeof _promise.default === 'undefined') {
|
|
|
15
15
|
}
|
|
16
16
|
var backoffPattern = [0, 1000, 2000, 4000, 8000, 16000, 32000, 32000, 32000];
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* @param {Function} fn
|
|
20
|
-
* @returns {Object}
|
|
18
|
+
/**
|
|
19
|
+
* @param {Function} fn
|
|
20
|
+
* @returns {Object}
|
|
21
21
|
*/
|
|
22
22
|
function retry(fn) {
|
|
23
23
|
return backoffPattern.reduce(function (promise, delay) {
|
|
@@ -34,10 +34,10 @@ function retry(fn) {
|
|
|
34
34
|
}, _promise.default.reject());
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* Determines the expected timeout for the test.
|
|
39
|
-
* @param {number} estimate estimated of how long a single attempt should take
|
|
40
|
-
* @returns {number}
|
|
37
|
+
/**
|
|
38
|
+
* Determines the expected timeout for the test.
|
|
39
|
+
* @param {number} estimate estimated of how long a single attempt should take
|
|
40
|
+
* @returns {number}
|
|
41
41
|
*/
|
|
42
42
|
function timeout(estimate) {
|
|
43
43
|
return backoffPattern.reduce(function (sum, next) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_promise","default","require","polyfill","backoffPattern","retry","fn","reduce","promise","delay","catch","err","resolve","console","error","concat","setTimeout","reject","timeout","estimate","sum","next","module","exports"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable max-nested-callbacks */\n\n/* istanbul ignore next */\nif (typeof Promise === 'undefined') {\n // eslint-disable-next-line global-require\n require('es6-promise').polyfill();\n}\n\nconst backoffPattern = [0, 1000, 2000, 4000, 8000, 16000, 32000, 32000, 32000];\n\n/**\n * @param {Function} fn\n * @returns {Object}\n */\nfunction retry(fn) {\n return backoffPattern.reduce(\n (promise, delay) =>\n promise.catch(\n (err) =>\n new Promise((resolve) => {\n if (err) {\n console.error(`###Test error: ${err}. Retrying test in ${delay} seconds`);\n }\n\n setTimeout(() => {\n resolve(fn());\n }, delay);\n })\n ),\n Promise.reject()\n );\n}\n\n/**\n * Determines the expected timeout for the test.\n * @param {number} estimate estimated of how long a single attempt should take\n * @returns {number}\n */\nfunction timeout(estimate) {\n return backoffPattern.reduce((sum, next) => sum + next + estimate, 0);\n}\n\nmodule.exports = retry;\nretry.timeout = timeout;\n"],"mappings":";;;;AAAA;AACA;AACA;;AAEA;;AAEA;AACA,IAAI,OAAAA,QAAA,CAAAC,OAAc,KAAK,WAAW,EAAE;EAClC;EACAC,OAAO,CAAC,aAAa,CAAC,CAACC,QAAQ,EAAE;AACnC;AAEA,IAAMC,cAAc,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;;AAE9E;AACA;AACA;AACA;AACA,SAASC,KAAKA,CAACC,EAAE,EAAE;EACjB,OAAOF,cAAc,CAACG,MAAM,CAC1B,UAACC,OAAO,EAAEC,KAAK;IAAA,OACbD,OAAO,CAACE,KAAK,CACX,UAACC,GAAG;MAAA,OACF,IAAAX,QAAA,CAAAC,OAAA,CAAY,UAACW,OAAO,EAAK;QACvB,IAAID,GAAG,EAAE;UACPE,OAAO,CAACC,KAAK,mBAAAC,MAAA,CAAmBJ,GAAG,yBAAAI,MAAA,CAAsBN,KAAK,cAAW;QAC3E;QAEAO,UAAU,CAAC,YAAM;UACfJ,OAAO,CAACN,EAAE,EAAE,CAAC;QACf,CAAC,EAAEG,KAAK,CAAC;MACX,CAAC,CAAC;IAAA,EACL;EAAA,GACHT,QAAA,CAAAC,OAAA,CAAQgB,MAAM,EAAE,CACjB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASC,OAAOA,CAACC,QAAQ,EAAE;EACzB,OAAOf,cAAc,CAACG,MAAM,CAAC,UAACa,GAAG,EAAEC,IAAI;IAAA,OAAKD,GAAG,GAAGC,IAAI,GAAGF,QAAQ;EAAA,GAAE,CAAC,CAAC;AACvE;AAEAG,MAAM,CAACC,OAAO,GAAGlB,KAAK;AACtBA,KAAK,CAACa,OAAO,GAAGA,OAAO"}
|
|
1
|
+
{"version":3,"names":["_promise","default","require","polyfill","backoffPattern","retry","fn","reduce","promise","delay","catch","err","resolve","console","error","concat","setTimeout","reject","timeout","estimate","sum","next","module","exports"],"sources":["index.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\n/* eslint-disable max-nested-callbacks */\r\n\r\n/* istanbul ignore next */\r\nif (typeof Promise === 'undefined') {\r\n // eslint-disable-next-line global-require\r\n require('es6-promise').polyfill();\r\n}\r\n\r\nconst backoffPattern = [0, 1000, 2000, 4000, 8000, 16000, 32000, 32000, 32000];\r\n\r\n/**\r\n * @param {Function} fn\r\n * @returns {Object}\r\n */\r\nfunction retry(fn) {\r\n return backoffPattern.reduce(\r\n (promise, delay) =>\r\n promise.catch(\r\n (err) =>\r\n new Promise((resolve) => {\r\n if (err) {\r\n console.error(`###Test error: ${err}. Retrying test in ${delay} seconds`);\r\n }\r\n\r\n setTimeout(() => {\r\n resolve(fn());\r\n }, delay);\r\n })\r\n ),\r\n Promise.reject()\r\n );\r\n}\r\n\r\n/**\r\n * Determines the expected timeout for the test.\r\n * @param {number} estimate estimated of how long a single attempt should take\r\n * @returns {number}\r\n */\r\nfunction timeout(estimate) {\r\n return backoffPattern.reduce((sum, next) => sum + next + estimate, 0);\r\n}\r\n\r\nmodule.exports = retry;\r\nretry.timeout = timeout;\r\n"],"mappings":";;;;AAAA;AACA;AACA;;AAEA;;AAEA;AACA,IAAI,OAAAA,QAAA,CAAAC,OAAc,KAAK,WAAW,EAAE;EAClC;EACAC,OAAO,CAAC,aAAa,CAAC,CAACC,QAAQ,EAAE;AACnC;AAEA,IAAMC,cAAc,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;;AAE9E;AACA;AACA;AACA;AACA,SAASC,KAAKA,CAACC,EAAE,EAAE;EACjB,OAAOF,cAAc,CAACG,MAAM,CAC1B,UAACC,OAAO,EAAEC,KAAK;IAAA,OACbD,OAAO,CAACE,KAAK,CACX,UAACC,GAAG;MAAA,OACF,IAAAX,QAAA,CAAAC,OAAA,CAAY,UAACW,OAAO,EAAK;QACvB,IAAID,GAAG,EAAE;UACPE,OAAO,CAACC,KAAK,mBAAAC,MAAA,CAAmBJ,GAAG,yBAAAI,MAAA,CAAsBN,KAAK,cAAW;QAC3E;QAEAO,UAAU,CAAC,YAAM;UACfJ,OAAO,CAACN,EAAE,EAAE,CAAC;QACf,CAAC,EAAEG,KAAK,CAAC;MACX,CAAC,CAAC;IAAA,EACL;EAAA,GACHT,QAAA,CAAAC,OAAA,CAAQgB,MAAM,EAAE,CACjB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASC,OAAOA,CAACC,QAAQ,EAAE;EACzB,OAAOf,cAAc,CAACG,MAAM,CAAC,UAACa,GAAG,EAAEC,IAAI;IAAA,OAAKD,GAAG,GAAGC,IAAI,GAAGF,QAAQ;EAAA,GAAE,CAAC,CAAC;AACvE;AAEAG,MAAM,CAACC,OAAO,GAAGlB,KAAK;AACtBA,KAAK,CAACa,OAAO,GAAGA,OAAO"}
|
package/jest.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const config = require('@webex/jest-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = config;
|
|
1
|
+
const config = require('@webex/jest-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/test-helper-retry",
|
|
3
|
-
"version": "2.59.2",
|
|
4
3
|
"description": "",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"main": "dist/index.js",
|
|
@@ -18,6 +17,7 @@
|
|
|
18
17
|
"scripts": {
|
|
19
18
|
"build": "yarn build:src",
|
|
20
19
|
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
|
|
20
|
+
"deploy:npm": "yarn npm publish",
|
|
21
21
|
"test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
|
|
22
22
|
"test:browser": "webex-legacy-tools test --integration --unit --runner karma",
|
|
23
23
|
"test:integration": "webex-legacy-tools test --integration --runner mocha",
|
|
@@ -26,15 +26,16 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/core": "^7.17.10",
|
|
29
|
-
"@webex/babel-config-legacy": "
|
|
30
|
-
"@webex/eslint-config-legacy": "
|
|
31
|
-
"@webex/jest-config-legacy": "
|
|
32
|
-
"@webex/legacy-tools": "
|
|
33
|
-
"@webex/test-helper-chai": "2.59.
|
|
34
|
-
"@webex/test-helper-mocha": "2.59.
|
|
35
|
-
"@webex/test-helper-mock-webex": "2.59.
|
|
36
|
-
"@webex/test-helper-test-users": "2.59.
|
|
29
|
+
"@webex/babel-config-legacy": "^0.0.0",
|
|
30
|
+
"@webex/eslint-config-legacy": "^0.0.0",
|
|
31
|
+
"@webex/jest-config-legacy": "^0.0.0",
|
|
32
|
+
"@webex/legacy-tools": "^0.0.0",
|
|
33
|
+
"@webex/test-helper-chai": "^2.59.3-next.1",
|
|
34
|
+
"@webex/test-helper-mocha": "^2.59.3-next.1",
|
|
35
|
+
"@webex/test-helper-mock-webex": "^2.59.3-next.1",
|
|
36
|
+
"@webex/test-helper-test-users": "^2.59.3-next.1",
|
|
37
37
|
"eslint": "^8.24.0",
|
|
38
38
|
"prettier": "^2.7.1"
|
|
39
|
-
}
|
|
40
|
-
|
|
39
|
+
},
|
|
40
|
+
"version": "2.59.3-next.1"
|
|
41
|
+
}
|
package/process
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {browser: true};
|
|
1
|
+
module.exports = {browser: true};
|
package/src/index.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-disable max-nested-callbacks */
|
|
6
|
-
|
|
7
|
-
/* istanbul ignore next */
|
|
8
|
-
if (typeof Promise === 'undefined') {
|
|
9
|
-
// eslint-disable-next-line global-require
|
|
10
|
-
require('es6-promise').polyfill();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const backoffPattern = [0, 1000, 2000, 4000, 8000, 16000, 32000, 32000, 32000];
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @param {Function} fn
|
|
17
|
-
* @returns {Object}
|
|
18
|
-
*/
|
|
19
|
-
function retry(fn) {
|
|
20
|
-
return backoffPattern.reduce(
|
|
21
|
-
(promise, delay) =>
|
|
22
|
-
promise.catch(
|
|
23
|
-
(err) =>
|
|
24
|
-
new Promise((resolve) => {
|
|
25
|
-
if (err) {
|
|
26
|
-
console.error(`###Test error: ${err}. Retrying test in ${delay} seconds`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
setTimeout(() => {
|
|
30
|
-
resolve(fn());
|
|
31
|
-
}, delay);
|
|
32
|
-
})
|
|
33
|
-
),
|
|
34
|
-
Promise.reject()
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Determines the expected timeout for the test.
|
|
40
|
-
* @param {number} estimate estimated of how long a single attempt should take
|
|
41
|
-
* @returns {number}
|
|
42
|
-
*/
|
|
43
|
-
function timeout(estimate) {
|
|
44
|
-
return backoffPattern.reduce((sum, next) => sum + next + estimate, 0);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
module.exports = retry;
|
|
48
|
-
retry.timeout = timeout;
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-disable max-nested-callbacks */
|
|
6
|
+
|
|
7
|
+
/* istanbul ignore next */
|
|
8
|
+
if (typeof Promise === 'undefined') {
|
|
9
|
+
// eslint-disable-next-line global-require
|
|
10
|
+
require('es6-promise').polyfill();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const backoffPattern = [0, 1000, 2000, 4000, 8000, 16000, 32000, 32000, 32000];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {Function} fn
|
|
17
|
+
* @returns {Object}
|
|
18
|
+
*/
|
|
19
|
+
function retry(fn) {
|
|
20
|
+
return backoffPattern.reduce(
|
|
21
|
+
(promise, delay) =>
|
|
22
|
+
promise.catch(
|
|
23
|
+
(err) =>
|
|
24
|
+
new Promise((resolve) => {
|
|
25
|
+
if (err) {
|
|
26
|
+
console.error(`###Test error: ${err}. Retrying test in ${delay} seconds`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
resolve(fn());
|
|
31
|
+
}, delay);
|
|
32
|
+
})
|
|
33
|
+
),
|
|
34
|
+
Promise.reject()
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Determines the expected timeout for the test.
|
|
40
|
+
* @param {number} estimate estimated of how long a single attempt should take
|
|
41
|
+
* @returns {number}
|
|
42
|
+
*/
|
|
43
|
+
function timeout(estimate) {
|
|
44
|
+
return backoffPattern.reduce((sum, next) => sum + next + estimate, 0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = retry;
|
|
48
|
+
retry.timeout = timeout;
|