@flemist/test-variants 2.0.1 → 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,69 +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;return l(this,function(
|
|
455
|
-
switch(
|
|
456
|
-
seed:
|
|
457
|
-
}),s=(V
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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(),
|
|
466
471
|
[2,"continue"]);case 6:
|
|
467
|
-
return
|
|
468
|
-
;case 7:
|
|
469
|
-
;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]
|
|
470
475
|
;case 9:return[3,13];case 10:
|
|
471
|
-
return
|
|
472
|
-
;case 11:
|
|
476
|
+
return at.hold(1)?[3,12]:[4,at.holdWait(1)]
|
|
477
|
+
;case 11:_.sent(),_.label=12;case 12:
|
|
473
478
|
c(r,void 0,void 0,function(){var r,s,i,o
|
|
474
479
|
;return l(this,function(c){switch(c.label){case 0:
|
|
475
480
|
return c.trys.push([0,3,6,7]),
|
|
476
|
-
(null==
|
|
481
|
+
(null==tt?void 0:tt.aborted)?[2]:g(r=t(n,e,tt))?[4,r]:[3,2]
|
|
477
482
|
;case 1:r=c.sent(),c.label=2;case 2:
|
|
478
483
|
return r?(s=r.iterationsAsync,i=r.iterationsSync,
|
|
479
|
-
|
|
480
|
-
return o=c.sent(),
|
|
481
|
-
;case 4:c.sent(),c.label=5;case 5:if(
|
|
482
|
-
;return
|
|
483
|
-
;case 6:return
|
|
484
|
-
})}),
|
|
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
|
|
485
490
|
;case 1:
|
|
486
|
-
return(null==
|
|
491
|
+
return(null==N?void 0:N.aborted)||!nt&&!function(){
|
|
487
492
|
for(;;){
|
|
488
|
-
if(
|
|
489
|
-
variantIndex:
|
|
490
|
-
totalIndex:
|
|
491
|
-
;if(
|
|
492
|
-
;if(
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
;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()]
|
|
499
503
|
;case 2:return s.sent(),[3,1];case 3:
|
|
500
|
-
return
|
|
501
|
-
s.sent(),
|
|
502
|
-
if(null==
|
|
503
|
-
;return
|
|
504
|
-
[4,Y(1)];case 6:return s.sent(),[2,
|
|
505
|
-
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
|
|
506
510
|
;return l(this,function(o){switch(o.label){case 0:
|
|
507
|
-
return
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
sessionDate:
|
|
511
|
-
})):null,
|
|
512
|
-
|
|
513
|
-
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){
|
|
514
518
|
var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0
|
|
515
519
|
;if(n)return n.call(t)
|
|
516
520
|
;if(t&&"number"==typeof t.length)return{
|
|
@@ -518,33 +522,33 @@ next:function(){
|
|
|
518
522
|
return t&&r>=t.length&&(t=void 0),{
|
|
519
523
|
value:t&&t[r++],done:!t}}}
|
|
520
524
|
;throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")
|
|
521
|
-
}(
|
|
522
|
-
return
|
|
523
|
-
;case 4:
|
|
524
|
-
return
|
|
525
|
-
;case 6:o.sent(),o.label=7;case 7:return
|
|
526
|
-
;case 8:return k
|
|
527
|
-
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
|
|
528
532
|
},[3,12];case 11:try{
|
|
529
|
-
|
|
530
|
-
if(
|
|
531
|
-
return
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
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){
|
|
540
544
|
let e,n;function r(t){e.abort(t)}
|
|
541
545
|
for(let s=0;s<t.length;s++){const i=t[s];if(i){
|
|
542
546
|
if(i.aborted)return i
|
|
543
547
|
;n?(e||(e=new I,n.subscribe(r)),i.subscribe(r)):n=i
|
|
544
548
|
}}return e?e.signal:n||(new I).signal
|
|
545
|
-
}(
|
|
546
|
-
|
|
547
|
-
;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
|
|
548
552
|
}]}})})}t.createTestVariants=function(t){
|
|
549
553
|
return function(e){return function(n){
|
|
550
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;
|
|
@@ -146,7 +158,19 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
146
158
|
const now = (logInterval || GC_Interval) && Date.now();
|
|
147
159
|
if (logInterval && now - prevLogTime >= logInterval) {
|
|
148
160
|
// the log is required to prevent the karma browserNoActivityTimeout
|
|
149
|
-
|
|
161
|
+
let log = '';
|
|
162
|
+
if (findBestError) {
|
|
163
|
+
log += `cycle: ${cycleIndex}, variant: ${index}`;
|
|
164
|
+
const _limitVariantsCount = getLimitVariantsCount();
|
|
165
|
+
if (_limitVariantsCount != null) {
|
|
166
|
+
log += `/${_limitVariantsCount}`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
log += `variant: ${index}`;
|
|
171
|
+
}
|
|
172
|
+
log += `, total: ${iterations}`;
|
|
173
|
+
console.log(log);
|
|
150
174
|
prevLogTime = now;
|
|
151
175
|
}
|
|
152
176
|
if (GC_Iterations && iterations - prevGC_Iterations >= GC_Iterations
|
|
@@ -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;
|
|
@@ -122,7 +134,19 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
122
134
|
const now = (logInterval || GC_Interval) && Date.now();
|
|
123
135
|
if (logInterval && now - prevLogTime >= logInterval) {
|
|
124
136
|
// the log is required to prevent the karma browserNoActivityTimeout
|
|
125
|
-
|
|
137
|
+
let log = '';
|
|
138
|
+
if (findBestError) {
|
|
139
|
+
log += `cycle: ${cycleIndex}, variant: ${index}`;
|
|
140
|
+
const _limitVariantsCount = getLimitVariantsCount();
|
|
141
|
+
if (_limitVariantsCount != null) {
|
|
142
|
+
log += `/${_limitVariantsCount}`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
log += `variant: ${index}`;
|
|
147
|
+
}
|
|
148
|
+
log += `, total: ${iterations}`;
|
|
149
|
+
console.log(log);
|
|
126
150
|
prevLogTime = now;
|
|
127
151
|
}
|
|
128
152
|
if (GC_Iterations && iterations - prevGC_Iterations >= GC_Iterations
|