@flemist/test-variants 2.0.2 → 2.0.3
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
|
@@ -448,71 +448,73 @@ setTimeout(function(){e(t)},1)})
|
|
|
448
448
|
var r,s,d,v,_,y,b,p,m
|
|
449
449
|
;return void 0===n&&(n={}),c(this,void 0,void 0,function(){
|
|
450
450
|
function w(){
|
|
451
|
+
return null!=U&&null!=L?Math.min(U,L.index):null!=U?U:null!=L?L.index:null
|
|
452
|
+
}function j(){
|
|
451
453
|
return c(this,void 0,void 0,function(){
|
|
452
454
|
var n,r=this;return l(this,function(s){
|
|
453
455
|
switch(s.label){case 0:n=function(){
|
|
454
|
-
var e,n,s,i,a,u,h,d;return l(this,function(
|
|
455
|
-
switch(
|
|
456
|
-
seed:
|
|
457
|
-
}),s=(V
|
|
458
|
-
i+="
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
return
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
456
|
+
var e,n,s,i,a,u,h,d,v;return l(this,function(_){
|
|
457
|
+
switch(_.label){case 0:return e=Q,n=o(o({},K),{
|
|
458
|
+
seed:B
|
|
459
|
+
}),s=(R||V)&&Date.now(),R&&s-it>=R&&(i="",$?(i+="cycle: ".concat(W,", variant: ").concat(Q),
|
|
460
|
+
null!=(a=w())&&(i+="/".concat(a))):i+="variant: ".concat(Q),
|
|
461
|
+
i+=", total: ".concat(rt),
|
|
462
|
+
console.log(i),it=s),D&&rt-ct>=D||C&&st-lt>=C||V&&s-ot>=V?(ct=rt,
|
|
463
|
+
lt=st,ot=s,[4,Y(1)]):[3,2];case 1:
|
|
464
|
+
_.sent(),_.label=2;case 2:
|
|
465
|
+
if(null==N?void 0:N.aborted)return[2,"continue"]
|
|
466
|
+
;if(at&&!tt.aborted)return[3,10];_.label=3;case 3:
|
|
467
|
+
return _.trys.push([3,6,,9]),g(u=t(n,e,tt))?[4,u]:[3,5]
|
|
468
|
+
;case 4:u=_.sent(),_.label=5;case 5:
|
|
469
|
+
return u?(h=u.iterationsAsync,d=u.iterationsSync,
|
|
470
|
+
st+=h,rt+=d+h,[3,9]):(nt=!0,Z.abort(),
|
|
468
471
|
[2,"continue"]);case 6:
|
|
469
|
-
return
|
|
470
|
-
;case 7:
|
|
471
|
-
;return
|
|
472
|
+
return v=_.sent(),P?[4,f(n,P,S.argsToJson)]:[3,8]
|
|
473
|
+
;case 7:_.sent(),_.label=8;case 8:if(!$)throw v
|
|
474
|
+
;return L={error:v,args:n,index:e},nt=!1,[3,9]
|
|
472
475
|
;case 9:return[3,13];case 10:
|
|
473
|
-
return
|
|
474
|
-
;case 11:
|
|
476
|
+
return at.hold(1)?[3,12]:[4,at.holdWait(1)]
|
|
477
|
+
;case 11:_.sent(),_.label=12;case 12:
|
|
475
478
|
c(r,void 0,void 0,function(){var r,s,i,o
|
|
476
479
|
;return l(this,function(c){switch(c.label){case 0:
|
|
477
480
|
return c.trys.push([0,3,6,7]),
|
|
478
|
-
(null==
|
|
481
|
+
(null==tt?void 0:tt.aborted)?[2]:g(r=t(n,e,tt))?[4,r]:[3,2]
|
|
479
482
|
;case 1:r=c.sent(),c.label=2;case 2:
|
|
480
483
|
return r?(s=r.iterationsAsync,i=r.iterationsSync,
|
|
481
|
-
|
|
482
|
-
return o=c.sent(),
|
|
483
|
-
;case 4:c.sent(),c.label=5;case 5:if(
|
|
484
|
-
;return
|
|
485
|
-
;case 6:return
|
|
486
|
-
})}),
|
|
484
|
+
st+=s,rt+=i+s,[3,7]):(nt=!0,Z.abort(),[2]);case 3:
|
|
485
|
+
return o=c.sent(),P?[4,f(n,P,S.argsToJson)]:[3,5]
|
|
486
|
+
;case 4:c.sent(),c.label=5;case 5:if(!$)throw o
|
|
487
|
+
;return L={error:o,args:n,index:e},nt=!1,[3,7]
|
|
488
|
+
;case 6:return at.release(1),[7];case 7:return[2]}
|
|
489
|
+
})}),_.label=13;case 13:return[2]}})},s.label=1
|
|
487
490
|
;case 1:
|
|
488
|
-
return(null==
|
|
491
|
+
return(null==N?void 0:N.aborted)||!nt&&!function(){
|
|
489
492
|
for(;;){
|
|
490
|
-
if(
|
|
491
|
-
variantIndex:
|
|
492
|
-
totalIndex:
|
|
493
|
-
;if(
|
|
494
|
-
;if(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
;L=-1,K=e[Symbol.iterator]()}}()?[3,3]:[5,n()]
|
|
493
|
+
if($&&Q>=0&&(null==L||Q<L.index)&&++q<$.repeatsPerVariant)return B=$.getSeed({
|
|
494
|
+
variantIndex:Q,cycleIndex:W,repeatIndex:q,
|
|
495
|
+
totalIndex:W*$.repeatsPerVariant+q}),!0
|
|
496
|
+
;if(q=0,Q++,$&&W>=$.cycles)return!1;var t=w()
|
|
497
|
+
;if(null==t||Q<t){var n=H.next()
|
|
498
|
+
;if(!n.done)return K=n.value,$&&(B=$.getSeed({
|
|
499
|
+
variantIndex:Q,cycleIndex:W,repeatIndex:q,
|
|
500
|
+
totalIndex:W*$.repeatsPerVariant+q})),!0}
|
|
501
|
+
if(!$)return!1;if(++W>=$.cycles)return!1
|
|
502
|
+
;Q=-1,H=e[Symbol.iterator]()}}()?[3,3]:[5,n()]
|
|
501
503
|
;case 2:return s.sent(),[3,1];case 3:
|
|
502
|
-
return
|
|
503
|
-
s.sent(),
|
|
504
|
-
if(null==
|
|
505
|
-
;return
|
|
506
|
-
[4,Y(1)];case 6:return s.sent(),[2,
|
|
507
|
-
var
|
|
504
|
+
return at?[4,at.holdWait(G)]:[3,5];case 4:
|
|
505
|
+
s.sent(),at.release(G),s.label=5;case 5:
|
|
506
|
+
if(null==et?void 0:et.aborted)throw et.reason
|
|
507
|
+
;return J&&console.log("[test-variants] variants: ".concat(Q,", iterations: ").concat(rt,", async: ").concat(st)),
|
|
508
|
+
[4,Y(1)];case 6:return s.sent(),[2,rt]}})})}
|
|
509
|
+
var S,x,E,P,A,k,T,z,O,M,F,D,C,V,R,J,N,$,G,U,W,q,B,L,Q,K,H,Z,tt,et,nt,rt,st,it,ot,ct,lt,at,ut,ht
|
|
508
510
|
;return l(this,function(o){switch(o.label){case 0:
|
|
509
|
-
return
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
sessionDate:
|
|
513
|
-
})):null,
|
|
514
|
-
|
|
515
|
-
o.trys.push([2,10,11,12]),
|
|
511
|
+
return S=n.saveErrorVariants,x=null!==(r=null==S?void 0:S.retriesPerVariant)&&void 0!==r?r:1,
|
|
512
|
+
E=new Date,
|
|
513
|
+
P=S?i.resolve(S.dir,null!==(d=null===(s=S.getFilePath)||void 0===s?void 0:s.call(S,{
|
|
514
|
+
sessionDate:E}))&&void 0!==d?d:h({sessionDate:E
|
|
515
|
+
})):null,S?[4,a(S.dir)]:[3,12];case 1:
|
|
516
|
+
A=o.sent(),o.label=2;case 2:
|
|
517
|
+
o.trys.push([2,10,11,12]),k=function(t){
|
|
516
518
|
var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0
|
|
517
519
|
;if(n)return n.call(t)
|
|
518
520
|
;if(t&&"number"==typeof t.length)return{
|
|
@@ -520,33 +522,33 @@ next:function(){
|
|
|
520
522
|
return t&&r>=t.length&&(t=void 0),{
|
|
521
523
|
value:t&&t[r++],done:!t}}}
|
|
522
524
|
;throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")
|
|
523
|
-
}(
|
|
524
|
-
return
|
|
525
|
-
;case 4:
|
|
526
|
-
return
|
|
527
|
-
;case 6:o.sent(),o.label=7;case 7:return
|
|
528
|
-
;case 8:return k
|
|
529
|
-
return[3,12];case 10:return
|
|
525
|
+
}(A),T=k.next(),o.label=3;case 3:
|
|
526
|
+
return T.done?[3,9]:[4,u(T.value,S.jsonToArgs)]
|
|
527
|
+
;case 4:z=o.sent(),O=0,o.label=5;case 5:
|
|
528
|
+
return O<x?g(M=t(z,-1,null))?[4,M]:[3,7]:[3,8]
|
|
529
|
+
;case 6:o.sent(),o.label=7;case 7:return O++,[3,5]
|
|
530
|
+
;case 8:return T=k.next(),[3,3];case 9:
|
|
531
|
+
return[3,12];case 10:return F=o.sent(),ut={error:F
|
|
530
532
|
},[3,12];case 11:try{
|
|
531
|
-
|
|
532
|
-
if(
|
|
533
|
-
return
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
533
|
+
T&&!T.done&&(ht=k.return)&&ht.call(k)}finally{
|
|
534
|
+
if(ut)throw ut.error}return[7];case 12:
|
|
535
|
+
return D=null!==(v=n.GC_Iterations)&&void 0!==v?v:1e6,
|
|
536
|
+
C=null!==(_=n.GC_IterationsAsync)&&void 0!==_?_:1e4,
|
|
537
|
+
V=null!==(y=n.GC_Interval)&&void 0!==y?y:1e3,
|
|
538
|
+
R=null!==(b=n.logInterval)&&void 0!==b?b:5e3,
|
|
539
|
+
J=null===(p=n.logCompleted)||void 0===p||p,
|
|
540
|
+
N=n.abortSignal,$=n.findBestError,G=!0===n.parallel?Math.pow(2,31):!n.parallel||n.parallel<=0?1:n.parallel,
|
|
541
|
+
U=null!==(m=n.limitVariantsCount)&&void 0!==m?m:null,
|
|
542
|
+
W=0,q=0,B=void 0,L=null,Q=-1,
|
|
543
|
+
K={},H=e[Symbol.iterator](),Z=new I,tt=function(...t){
|
|
542
544
|
let e,n;function r(t){e.abort(t)}
|
|
543
545
|
for(let s=0;s<t.length;s++){const i=t[s];if(i){
|
|
544
546
|
if(i.aborted)return i
|
|
545
547
|
;n?(e||(e=new I,n.subscribe(r)),i.subscribe(r)):n=i
|
|
546
548
|
}}return e?e.signal:n||(new I).signal
|
|
547
|
-
}(
|
|
548
|
-
|
|
549
|
-
;case 13:return[2,{iterations:o.sent(),bestError:
|
|
549
|
+
}(N,Z.signal),et=tt,nt=!1,rt=0,st=0,it=Date.now(),
|
|
550
|
+
ot=it,ct=rt,lt=st,at=G<=1?null:new X(G),[4,j()]
|
|
551
|
+
;case 13:return[2,{iterations:o.sent(),bestError:L
|
|
550
552
|
}]}})})}t.createTestVariants=function(t){
|
|
551
553
|
return function(e){return function(n){
|
|
552
554
|
return c(this,void 0,void 0,function(){var r,s
|
|
@@ -73,6 +73,18 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
73
73
|
let index = -1;
|
|
74
74
|
let args = {};
|
|
75
75
|
let variantsIterator = variants[Symbol.iterator]();
|
|
76
|
+
function getLimitVariantsCount() {
|
|
77
|
+
if (limitVariantsCount != null && bestError != null) {
|
|
78
|
+
return Math.min(limitVariantsCount, bestError.index);
|
|
79
|
+
}
|
|
80
|
+
if (limitVariantsCount != null) {
|
|
81
|
+
return limitVariantsCount;
|
|
82
|
+
}
|
|
83
|
+
if (bestError != null) {
|
|
84
|
+
return bestError.index;
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
76
88
|
function nextVariant() {
|
|
77
89
|
while (true) {
|
|
78
90
|
// Try next repeat for current variant
|
|
@@ -93,8 +105,8 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
93
105
|
if (findBestError && cycleIndex >= findBestError.cycles) {
|
|
94
106
|
return false;
|
|
95
107
|
}
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
const _limitVariantsCount = getLimitVariantsCount();
|
|
109
|
+
if (_limitVariantsCount == null || index < _limitVariantsCount) {
|
|
98
110
|
const result = variantsIterator.next();
|
|
99
111
|
if (!result.done) {
|
|
100
112
|
args = result.value;
|
|
@@ -148,7 +160,11 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
148
160
|
// the log is required to prevent the karma browserNoActivityTimeout
|
|
149
161
|
let log = '';
|
|
150
162
|
if (findBestError) {
|
|
151
|
-
log += `cycle: ${cycleIndex}, variant: ${index}
|
|
163
|
+
log += `cycle: ${cycleIndex}, variant: ${index}`;
|
|
164
|
+
const _limitVariantsCount = getLimitVariantsCount();
|
|
165
|
+
if (_limitVariantsCount != null) {
|
|
166
|
+
log += `/${_limitVariantsCount}`;
|
|
167
|
+
}
|
|
152
168
|
}
|
|
153
169
|
else {
|
|
154
170
|
log += `variant: ${index}`;
|
|
@@ -49,6 +49,18 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
49
49
|
let index = -1;
|
|
50
50
|
let args = {};
|
|
51
51
|
let variantsIterator = variants[Symbol.iterator]();
|
|
52
|
+
function getLimitVariantsCount() {
|
|
53
|
+
if (limitVariantsCount != null && bestError != null) {
|
|
54
|
+
return Math.min(limitVariantsCount, bestError.index);
|
|
55
|
+
}
|
|
56
|
+
if (limitVariantsCount != null) {
|
|
57
|
+
return limitVariantsCount;
|
|
58
|
+
}
|
|
59
|
+
if (bestError != null) {
|
|
60
|
+
return bestError.index;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
52
64
|
function nextVariant() {
|
|
53
65
|
while (true) {
|
|
54
66
|
// Try next repeat for current variant
|
|
@@ -69,8 +81,8 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
69
81
|
if (findBestError && cycleIndex >= findBestError.cycles) {
|
|
70
82
|
return false;
|
|
71
83
|
}
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
const _limitVariantsCount = getLimitVariantsCount();
|
|
85
|
+
if (_limitVariantsCount == null || index < _limitVariantsCount) {
|
|
74
86
|
const result = variantsIterator.next();
|
|
75
87
|
if (!result.done) {
|
|
76
88
|
args = result.value;
|
|
@@ -124,7 +136,11 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
124
136
|
// the log is required to prevent the karma browserNoActivityTimeout
|
|
125
137
|
let log = '';
|
|
126
138
|
if (findBestError) {
|
|
127
|
-
log += `cycle: ${cycleIndex}, variant: ${index}
|
|
139
|
+
log += `cycle: ${cycleIndex}, variant: ${index}`;
|
|
140
|
+
const _limitVariantsCount = getLimitVariantsCount();
|
|
141
|
+
if (_limitVariantsCount != null) {
|
|
142
|
+
log += `/${_limitVariantsCount}`;
|
|
143
|
+
}
|
|
128
144
|
}
|
|
129
145
|
else {
|
|
130
146
|
log += `variant: ${index}`;
|