@flemist/test-variants 1.0.4 → 1.0.6
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
|
@@ -221,9 +221,9 @@ e=n.item,t.delete(n)}
|
|
|
221
221
|
if(e.abortSignal&&e.abortSignal.aborted)e.reject(e.abortSignal.reason);else try{
|
|
222
222
|
let t=e.func&&e.func(e.abortSignal)
|
|
223
223
|
;t&&"function"==typeof t.then&&(t=yield t),e.resolve(t)
|
|
224
|
-
}catch(t){e.reject(t)}}}))}}const
|
|
224
|
+
}catch(t){e.reject(t)}}}))}}const A=function(){
|
|
225
225
|
const t=new z;return function(e,n){
|
|
226
|
-
return t.run(void 0,e,n)}}();class
|
|
226
|
+
return t.run(void 0,e,n)}}();class E{
|
|
227
227
|
constructor(t){
|
|
228
228
|
if(this._maxSize=0,this._size=0,this._tickPromise=new x,!t)throw new Error("maxSize should be > 0")
|
|
229
229
|
;this._maxSize=t,
|
|
@@ -248,7 +248,7 @@ e.then((function(t){r&&r(),n(t)
|
|
|
248
248
|
})).catch(i),t&&(r=t.subscribe(i))})):e
|
|
249
249
|
}(t,this._tickPromise.promise)}holdWait(t,e,r,s){
|
|
250
250
|
if(t>this.maxSize)throw new Error(`holdCount (${t} > maxSize (${this.maxSize}))`)
|
|
251
|
-
;return s||(s=
|
|
251
|
+
;return s||(s=A),
|
|
252
252
|
this._priorityQueue.run((r=>n(this,void 0,void 0,(function*(){
|
|
253
253
|
for(;t>this._size;)yield this.tick(r),yield s(e,r)
|
|
254
254
|
;if(!this.hold(t))throw new Error("Unexpected behavior")
|
|
@@ -260,22 +260,24 @@ for(let s=0;s<t.length;s++){const i=t[s];if(i){
|
|
|
260
260
|
if(i.aborted){r.call(i);break}
|
|
261
261
|
n?(e||(e=new c,n.subscribe(r)),i.subscribe(r)):n=i
|
|
262
262
|
}}return e?e.signal:n||(new c).signal
|
|
263
|
-
}(j,P.signal),k=S,z=Object.keys(i),
|
|
264
|
-
;function F(t){var e=
|
|
263
|
+
}(j,P.signal),k=S,z=Object.keys(i),A=Object.values(i),T=z.length,O={}
|
|
264
|
+
;function F(t){var e=A[t]
|
|
265
265
|
;return"function"==typeof e&&(e=e(O)),e}
|
|
266
|
-
for(var I=[],R=[],M=0;M<
|
|
267
|
-
;R[0]=F(0);var C=0,D=0,G=!1,$=0
|
|
268
|
-
|
|
266
|
+
for(var I=[],R=[],M=0;M<T;M++)I[M]=-1,R[M]=[]
|
|
267
|
+
;R[0]=F(0);var C=0,D=0,G=!1,$=0,q=!0
|
|
268
|
+
;function N(t,e,s){
|
|
269
|
+
return n(this,void 0,void 0,(function(){var n,i
|
|
269
270
|
;return r(this,(function(r){switch(r.label){
|
|
270
271
|
case 0:
|
|
271
|
-
return P.abort(t),console.error("error variant: ".concat(e,"\r\n").concat(JSON.stringify(s,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
;case
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
272
|
+
return n=q,q=!1,n&&(P.abort(t),console.error("error variant: ".concat(e,"\r\n").concat(JSON.stringify(s,(function(t,e){
|
|
273
|
+
return e&&"object"==typeof e&&!Array.isArray(e)&&e.constructor!==Object?e+"":e
|
|
274
|
+
}),2))),
|
|
275
|
+
console.error(t)),i=Date.now(),Date.now()-i>50&&$<5?(console.log("DEBUG ITERATION: "+$),
|
|
276
|
+
G=!0,[4,H()]):[3,2];case 1:r.sent(),$++,r.label=2
|
|
277
|
+
;case 2:if(n)throw g&&g({iteration:e,variant:s,
|
|
278
|
+
error:t}),t;return[2]}}))}))}
|
|
279
|
+
var U=Date.now(),W=U,Q=C,B=D,J=!0===x?Math.pow(2,31):!x||x<=0?1:x,K=J<=1?null:new E(J)
|
|
280
|
+
;function V(e,s,i){
|
|
279
281
|
return n(this,void 0,void 0,(function(){var n,o,l
|
|
280
282
|
;return r(this,(function(r){switch(r.label){
|
|
281
283
|
case 0:return r.trys.push([0,3,,5]),function(t){
|
|
@@ -283,40 +285,40 @@ return"object"==typeof t&&t&&"function"==typeof t.then
|
|
|
283
285
|
}(n=t(s,i))?[4,n]:[3,2];case 1:
|
|
284
286
|
return o=r.sent(),D+=l="number"==typeof o?o:1,C+=l,
|
|
285
287
|
[2];case 2:return C+="number"==typeof n?n:1,[3,5]
|
|
286
|
-
;case 3:return[4,
|
|
288
|
+
;case 3:return[4,N(r.sent(),e,s)];case 4:
|
|
287
289
|
return r.sent(),[3,5];case 5:return[2]}}))}))}
|
|
288
|
-
function
|
|
290
|
+
function H(){
|
|
289
291
|
return n(this,void 0,void 0,(function(){
|
|
290
292
|
var t,i=this;return r(this,(function(o){
|
|
291
293
|
switch(o.label){case 0:t=function(){var t,o,l
|
|
292
294
|
;return r(this,(function(c){switch(c.label){
|
|
293
295
|
case 0:
|
|
294
|
-
return t=C,o=
|
|
295
|
-
|
|
296
|
-
|
|
296
|
+
return t=C,o=K?e({},O):O,l=(b||_)&&Date.now(),b&&l-U>=b&&(console.log(C),
|
|
297
|
+
U=l),a&&C-Q>=a||f&&D-B>=f||_&&l-W>=_?(Q=C,
|
|
298
|
+
B=D,W=l,[4,s(1)]):[3,2];case 1:
|
|
297
299
|
return c.sent(),[2,"continue"];case 2:
|
|
298
|
-
return(null==j?void 0:j.aborted)?[2,"continue"]:
|
|
300
|
+
return(null==j?void 0:j.aborted)?[2,"continue"]:K&&!S.aborted?[3,4]:[4,V(t,o,j)]
|
|
299
301
|
;case 3:return c.sent(),[3,7];case 4:
|
|
300
|
-
return
|
|
302
|
+
return K.hold(1)?[3,6]:[4,K.holdWait(1)];case 5:
|
|
301
303
|
c.sent(),c.label=6;case 6:
|
|
302
304
|
n(i,void 0,void 0,(function(){
|
|
303
305
|
return r(this,(function(e){switch(e.label){case 0:
|
|
304
|
-
return e.trys.push([0,,2,3]),(null==S?void 0:S.aborted)?[2]:[4,
|
|
306
|
+
return e.trys.push([0,,2,3]),(null==S?void 0:S.aborted)?[2]:[4,V(t,o,S)]
|
|
305
307
|
;case 1:return e.sent(),[3,3];case 2:
|
|
306
|
-
return
|
|
308
|
+
return K.release(1),[7];case 3:return[2]}}))
|
|
307
309
|
})),c.label=7;case 7:return[2]}}))},o.label=1
|
|
308
310
|
;case 1:
|
|
309
311
|
return(null==j?void 0:j.aborted)||!G&&!function(){
|
|
310
|
-
for(var t=
|
|
312
|
+
for(var t=T-1;t>=0;t--){var e=I[t]+1
|
|
311
313
|
;if(e<R[t].length){
|
|
312
|
-
for(I[t]=e,O[z[t]]=R[t][e],t++;t<
|
|
314
|
+
for(I[t]=e,O[z[t]]=R[t][e],t++;t<T;t++){var n=F(t)
|
|
313
315
|
;if(0===n.length)break;I[t]=0,R[t]=n,O[z[t]]=n[0]}
|
|
314
|
-
if(t>=
|
|
316
|
+
if(t>=T)return!0}}return!1}()?[3,3]:[5,t()]
|
|
315
317
|
;case 2:return o.sent(),[3,1];case 3:
|
|
316
|
-
return
|
|
317
|
-
o.sent(),
|
|
318
|
+
return K?[4,K.holdWait(J)]:[3,5];case 4:
|
|
319
|
+
o.sent(),K.release(J),o.label=5;case 5:
|
|
318
320
|
if(null==k?void 0:k.aborted)throw k.reason
|
|
319
321
|
;return y&&console.log("variants: "+C),[4,s(1)]
|
|
320
|
-
;case 6:return o.sent(),[2,C]}}))}))}return
|
|
322
|
+
;case 6:return o.sent(),[2,C]}}))}))}return H()}}
|
|
321
323
|
},Object.defineProperty(t,"__esModule",{value:!0})
|
|
322
324
|
}({});
|
|
@@ -64,11 +64,24 @@ function createTestVariants(test) {
|
|
|
64
64
|
let iterationsAsync = 0;
|
|
65
65
|
let debug = false;
|
|
66
66
|
let debugIteration = 0;
|
|
67
|
+
let isNewError = true;
|
|
67
68
|
function onError(error, iterations, variantArgs) {
|
|
68
69
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const _isNewError = isNewError;
|
|
71
|
+
isNewError = false;
|
|
72
|
+
if (_isNewError) {
|
|
73
|
+
abortControllerParallel.abort(error);
|
|
74
|
+
console.error(`error variant: ${iterations}\r\n${JSON.stringify(variantArgs, (_, value) => {
|
|
75
|
+
if (value
|
|
76
|
+
&& typeof value === 'object'
|
|
77
|
+
&& !Array.isArray(value)
|
|
78
|
+
&& value.constructor !== Object) {
|
|
79
|
+
return value + '';
|
|
80
|
+
}
|
|
81
|
+
return value;
|
|
82
|
+
}, 2)}`);
|
|
83
|
+
console.error(error);
|
|
84
|
+
}
|
|
72
85
|
// rerun failed variant 5 times for debug
|
|
73
86
|
const time0 = Date.now();
|
|
74
87
|
// eslint-disable-next-line no-debugger
|
|
@@ -79,14 +92,16 @@ function createTestVariants(test) {
|
|
|
79
92
|
yield next();
|
|
80
93
|
debugIteration++;
|
|
81
94
|
}
|
|
82
|
-
if (
|
|
83
|
-
onErrorCallback
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
if (_isNewError) {
|
|
96
|
+
if (onErrorCallback) {
|
|
97
|
+
onErrorCallback({
|
|
98
|
+
iteration: iterations,
|
|
99
|
+
variant: variantArgs,
|
|
100
|
+
error,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
throw error;
|
|
88
104
|
}
|
|
89
|
-
throw error;
|
|
90
105
|
});
|
|
91
106
|
}
|
|
92
107
|
function onCompleted() {
|
|
@@ -60,11 +60,24 @@ function createTestVariants(test) {
|
|
|
60
60
|
let iterationsAsync = 0;
|
|
61
61
|
let debug = false;
|
|
62
62
|
let debugIteration = 0;
|
|
63
|
+
let isNewError = true;
|
|
63
64
|
function onError(error, iterations, variantArgs) {
|
|
64
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
const _isNewError = isNewError;
|
|
67
|
+
isNewError = false;
|
|
68
|
+
if (_isNewError) {
|
|
69
|
+
abortControllerParallel.abort(error);
|
|
70
|
+
console.error(`error variant: ${iterations}\r\n${JSON.stringify(variantArgs, (_, value) => {
|
|
71
|
+
if (value
|
|
72
|
+
&& typeof value === 'object'
|
|
73
|
+
&& !Array.isArray(value)
|
|
74
|
+
&& value.constructor !== Object) {
|
|
75
|
+
return value + '';
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
}, 2)}`);
|
|
79
|
+
console.error(error);
|
|
80
|
+
}
|
|
68
81
|
// rerun failed variant 5 times for debug
|
|
69
82
|
const time0 = Date.now();
|
|
70
83
|
// eslint-disable-next-line no-debugger
|
|
@@ -75,14 +88,16 @@ function createTestVariants(test) {
|
|
|
75
88
|
yield next();
|
|
76
89
|
debugIteration++;
|
|
77
90
|
}
|
|
78
|
-
if (
|
|
79
|
-
onErrorCallback
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
if (_isNewError) {
|
|
92
|
+
if (onErrorCallback) {
|
|
93
|
+
onErrorCallback({
|
|
94
|
+
iteration: iterations,
|
|
95
|
+
variant: variantArgs,
|
|
96
|
+
error,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
84
100
|
}
|
|
85
|
-
throw error;
|
|
86
101
|
});
|
|
87
102
|
}
|
|
88
103
|
function onCompleted() {
|