@flemist/test-variants 0.0.4 → 0.0.5
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/dist/bundle/browser.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
!function(r){"use strict"
|
|
2
2
|
;r.createTestVariants=function(r){
|
|
3
3
|
return function(e){return function(t){
|
|
4
|
-
var n=(void 0===t?{}:t).forceAwaitInterval,o=Object.keys(e),
|
|
5
|
-
;function c(r){var e=
|
|
6
|
-
;return"function"==typeof e&&(e=e(
|
|
7
|
-
for(var i=[],v=[],l=0;l<
|
|
8
|
-
;function s(){for(var r=
|
|
4
|
+
var n=(void 0===t?{}:t).forceAwaitInterval,o=Object.keys(e),a=Object.values(e),f=o.length,u={}
|
|
5
|
+
;function c(r){var e=a[r]
|
|
6
|
+
;return"function"==typeof e&&(e=e(u)),e}
|
|
7
|
+
for(var i=[],v=[],l=0;l<f;l++)i[l]=-1,v[l]=[]
|
|
8
|
+
;function s(){for(var r=f-1;r>=0;r--){var e=i[r]+1
|
|
9
9
|
;if(e<v[r].length){
|
|
10
|
-
for(i[r]=e,
|
|
11
|
-
;if(0===t.length)break;i[r]=0,v[r]=t,
|
|
12
|
-
if(r>=
|
|
13
|
-
;var h=0,y=!1,b=0;function
|
|
14
|
-
console.error(JSON.stringify(
|
|
10
|
+
for(i[r]=e,u[o[r]]=v[r][e],r++;r<f;r++){var t=c(r)
|
|
11
|
+
;if(0===t.length)break;i[r]=0,v[r]=t,u[o[r]]=t[0]}
|
|
12
|
+
if(r>=f)return!0}}return!1}v[0]=c(0)
|
|
13
|
+
;var h=0,y=!1,b=0;function w(r){
|
|
14
|
+
console.error(JSON.stringify(u,null,2)),console.error(r)
|
|
15
15
|
;var e=Date.now()
|
|
16
|
-
;throw Date.now()-e>50&&b<5&&(y=!0,
|
|
17
|
-
function
|
|
18
|
-
;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
;
|
|
22
|
-
return
|
|
16
|
+
;throw Date.now()-e>50&&b<5&&(y=!0,g(0),b++),r}
|
|
17
|
+
var p=Date.now();function g(e){var t=n&&Date.now()
|
|
18
|
+
;t&&t-p>=n&&(console.log(h),p=t),
|
|
19
|
+
h+="number"==typeof e?e:1;for(var o=t;y||s();)try{
|
|
20
|
+
var a=r(u)
|
|
21
|
+
;if("object"==typeof a&&a&&"function"==typeof a.then)return a.then(g).catch(w)
|
|
22
|
+
;if(o&&Date.now()-o>=n)return Promise.resolve(a).then(g)
|
|
23
|
+
;h+="number"==typeof a?a:1}catch(r){w(r)}return h}
|
|
24
|
+
return g(0)}}
|
|
23
25
|
},Object.defineProperty(r,"__esModule",{value:!0})
|
|
24
26
|
}({});
|
|
@@ -61,9 +61,17 @@ function createTestVariants(test) {
|
|
|
61
61
|
}
|
|
62
62
|
throw err;
|
|
63
63
|
}
|
|
64
|
+
let prevLogTime = Date.now();
|
|
64
65
|
function next(value) {
|
|
66
|
+
const now = forceAwaitInterval && Date.now();
|
|
67
|
+
if (now) {
|
|
68
|
+
if (now - prevLogTime >= forceAwaitInterval) {
|
|
69
|
+
console.log(iterations);
|
|
70
|
+
prevLogTime = now;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
65
73
|
iterations += typeof value === 'number' ? value : 1;
|
|
66
|
-
const
|
|
74
|
+
const syncCallStartTime = now;
|
|
67
75
|
while (debug || nextVariant()) {
|
|
68
76
|
try {
|
|
69
77
|
const promiseOrIterations = test(variantArgs);
|
|
@@ -72,7 +80,7 @@ function createTestVariants(test) {
|
|
|
72
80
|
&& typeof promiseOrIterations.then === 'function') {
|
|
73
81
|
return promiseOrIterations.then(next).catch(onError);
|
|
74
82
|
}
|
|
75
|
-
if (
|
|
83
|
+
if (syncCallStartTime && Date.now() - syncCallStartTime >= forceAwaitInterval) {
|
|
76
84
|
return Promise.resolve(promiseOrIterations).then(next);
|
|
77
85
|
}
|
|
78
86
|
iterations += typeof promiseOrIterations === 'number' ? promiseOrIterations : 1;
|
|
@@ -59,9 +59,17 @@ function createTestVariants(test) {
|
|
|
59
59
|
}
|
|
60
60
|
throw err;
|
|
61
61
|
}
|
|
62
|
+
let prevLogTime = Date.now();
|
|
62
63
|
function next(value) {
|
|
64
|
+
const now = forceAwaitInterval && Date.now();
|
|
65
|
+
if (now) {
|
|
66
|
+
if (now - prevLogTime >= forceAwaitInterval) {
|
|
67
|
+
console.log(iterations);
|
|
68
|
+
prevLogTime = now;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
63
71
|
iterations += typeof value === 'number' ? value : 1;
|
|
64
|
-
const
|
|
72
|
+
const syncCallStartTime = now;
|
|
65
73
|
while (debug || nextVariant()) {
|
|
66
74
|
try {
|
|
67
75
|
const promiseOrIterations = test(variantArgs);
|
|
@@ -70,7 +78,7 @@ function createTestVariants(test) {
|
|
|
70
78
|
&& typeof promiseOrIterations.then === 'function') {
|
|
71
79
|
return promiseOrIterations.then(next).catch(onError);
|
|
72
80
|
}
|
|
73
|
-
if (
|
|
81
|
+
if (syncCallStartTime && Date.now() - syncCallStartTime >= forceAwaitInterval) {
|
|
74
82
|
return Promise.resolve(promiseOrIterations).then(next);
|
|
75
83
|
}
|
|
76
84
|
iterations += typeof promiseOrIterations === 'number' ? promiseOrIterations : 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemist/test-variants",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Runs a test function with all possible combinations of its parameters.",
|
|
5
5
|
"main": "dist/lib/index.cjs",
|
|
6
6
|
"module": "dist/lib/index.mjs",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@babel/runtime-corejs3": "7.18.3",
|
|
42
42
|
"@flemist/copy-glob-flat": "0.0.5",
|
|
43
43
|
"@flemist/karma-custom-launcher": "0.0.0",
|
|
44
|
-
"@flemist/test-utils": "
|
|
44
|
+
"@flemist/test-utils": "0.0.5",
|
|
45
45
|
"@rollup/plugin-alias": "3.1.9",
|
|
46
46
|
"@rollup/plugin-babel": "5.3.1",
|
|
47
47
|
"@rollup/plugin-commonjs": "22.0.0",
|