@flemist/test-variants 0.0.8 → 0.0.9

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.
@@ -1,33 +1,33 @@
1
1
  !function(e){"use strict"
2
2
  ;e.createTestVariants=function(e){
3
3
  return function(t){return function(n){
4
- var r=void 0===n?{}:n,o=r.pauseInterval,u=void 0===o?1e3:o,a=r.pauseTime,i=void 0===a?10:a,f=r.logInterval,c=void 0===f?1e4:f,v=r.logCompleted,l=void 0===v||v,s=Object.keys(t),p=Object.values(t),y=s.length,h={}
5
- ;function b(e){var t=p[e]
6
- ;return"function"==typeof t&&(t=t(h)),t}
7
- for(var d=[],g=[],m=0;m<y;m++)d[m]=-1,g[m]=[]
8
- ;function w(){for(var e=y-1;e>=0;e--){var t=d[e]+1
9
- ;if(t<g[e].length){
10
- for(d[e]=t,h[s[e]]=g[e][t],e++;e<y;e++){var n=b(e)
11
- ;if(0===n.length)break;d[e]=0,g[e]=n,h[s[e]]=n[0]}
12
- if(e>=y)return!0}}return!1}g[0]=b(0)
13
- ;var j=0,D=!1,O=0;function P(e){
14
- console.error(JSON.stringify(h,null,2)),console.error(e)
4
+ var o=void 0===n?{}:n,r=o.pauseInterval,u=void 0===r?1e3:r,a=o.pauseTime,i=void 0===a?10:a,f=o.logInterval,c=void 0===f?1e4:f,v=o.logCompleted,l=void 0===v||v,s=Object.keys(t),p=Object.values(t),y=s.length,g={}
5
+ ;function h(e){var t=p[e]
6
+ ;return"function"==typeof t&&(t=t(g)),t}
7
+ for(var b=[],d=[],m=0;m<y;m++)b[m]=-1,d[m]=[]
8
+ ;function w(){for(var e=y-1;e>=0;e--){var t=b[e]+1
9
+ ;if(t<d[e].length){
10
+ for(b[e]=t,g[s[e]]=d[e][t],e++;e<y;e++){var n=h(e)
11
+ ;if(0===n.length)break;b[e]=0,d[e]=n,g[s[e]]=n[0]}
12
+ if(e>=y)return!0}}return!1}d[0]=h(0)
13
+ ;var D=0,j=!1,O=0;function T(e){
14
+ console.error(JSON.stringify(g,null,2))
15
15
  ;var t=Date.now()
16
- ;throw Date.now()-t>50&&O<5&&(D=!0,k(0),O++),e}
17
- var T=Date.now();function k(t){
16
+ ;throw Date.now()-t>50&&O<5&&(console.log("DEBUG ITERATION: "+O),
17
+ j=!0,P(0),O++),e}var I=Date.now();function P(t){
18
18
  var n=(c||u)&&Date.now()
19
- ;n&&n-T>=c&&(console.log(j),T=n),j+="number"==typeof t?t:1
20
- ;for(var r=u&&n,o=function(){try{var t=e(h)
19
+ ;n&&n-I>=c&&(console.log(D),I=n),D+="number"==typeof t?t:1
20
+ ;for(var o=u&&n,r=function(){try{var t=e(g)
21
21
  ;if("object"==typeof t&&t&&"function"==typeof t.then)return{
22
- value:t.then(k).catch(P)}
23
- ;if(r&&Date.now()-r>=u)return{
22
+ value:t.catch(T).then(P)}
23
+ ;if(o&&Date.now()-o>=u)return{
24
24
  value:(i?new Promise((function(e){
25
25
  setTimeout((function(){e(t)}),i)
26
- })):Promise.resolve(t)).then(k)}
27
- ;j+="number"==typeof t?t:1}catch(e){P(e)}
28
- };D||w();){var a=o()
26
+ })):Promise.resolve(t)).then(P)}
27
+ ;D+="number"==typeof t?t:1}catch(e){T(e)}
28
+ };j||w();){var a=r()
29
29
  ;if("object"==typeof a)return a.value}
30
- return l&&console.log("variants: "+j),j}
31
- return k(0)}}
30
+ return l&&console.log("variants: "+D),D}
31
+ return P(0)}}
32
32
  },Object.defineProperty(e,"__esModule",{value:!0})
33
33
  }({});
@@ -49,12 +49,13 @@ function createTestVariants(test) {
49
49
  let debugIteration = 0;
50
50
  function onError(err) {
51
51
  console.error(JSON.stringify(variantArgs, null, 2));
52
- console.error(err);
52
+ // console.error(err)
53
53
  // rerun failed variant 5 times for debug
54
54
  const time0 = Date.now();
55
55
  // eslint-disable-next-line no-debugger
56
56
  debugger;
57
57
  if (Date.now() - time0 > 50 && debugIteration < 5) {
58
+ console.log('DEBUG ITERATION: ' + debugIteration);
58
59
  debug = true;
59
60
  next(0);
60
61
  debugIteration++;
@@ -84,7 +85,7 @@ function createTestVariants(test) {
84
85
  if (typeof promiseOrIterations === 'object'
85
86
  && promiseOrIterations
86
87
  && typeof promiseOrIterations.then === 'function') {
87
- return promiseOrIterations.then(next).catch(onError);
88
+ return promiseOrIterations.catch(onError).then(next);
88
89
  }
89
90
  if (syncCallStartTime && Date.now() - syncCallStartTime >= pauseInterval) {
90
91
  const pausePromise = pauseTime
@@ -47,12 +47,13 @@ function createTestVariants(test) {
47
47
  let debugIteration = 0;
48
48
  function onError(err) {
49
49
  console.error(JSON.stringify(variantArgs, null, 2));
50
- console.error(err);
50
+ // console.error(err)
51
51
  // rerun failed variant 5 times for debug
52
52
  const time0 = Date.now();
53
53
  // eslint-disable-next-line no-debugger
54
54
  debugger;
55
55
  if (Date.now() - time0 > 50 && debugIteration < 5) {
56
+ console.log('DEBUG ITERATION: ' + debugIteration);
56
57
  debug = true;
57
58
  next(0);
58
59
  debugIteration++;
@@ -82,7 +83,7 @@ function createTestVariants(test) {
82
83
  if (typeof promiseOrIterations === 'object'
83
84
  && promiseOrIterations
84
85
  && typeof promiseOrIterations.then === 'function') {
85
- return promiseOrIterations.then(next).catch(onError);
86
+ return promiseOrIterations.catch(onError).then(next);
86
87
  }
87
88
  if (syncCallStartTime && Date.now() - syncCallStartTime >= pauseInterval) {
88
89
  const pausePromise = pauseTime
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flemist/test-variants",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
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",