@flemist/test-variants 1.0.0 → 1.0.2
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 +317 -75
- package/dist/lib/index.cjs +3 -0
- package/dist/lib/index.mjs +3 -0
- package/dist/lib/test-variants/createTestVariants.cjs +80 -33
- package/dist/lib/test-variants/createTestVariants.d.ts +1 -1
- package/dist/lib/test-variants/createTestVariants.mjs +80 -33
- package/dist/lib/test-variants/createTestVariants.perf.cjs +3 -0
- package/dist/lib/test-variants/createTestVariants.perf.mjs +3 -0
- package/package.json +24 -23
package/dist/bundle/browser.js
CHANGED
|
@@ -1,80 +1,322 @@
|
|
|
1
|
-
!function(
|
|
2
|
-
return
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
!function(t){"use strict";var e=function(){
|
|
2
|
+
return e=Object.assign||function(t){
|
|
3
|
+
for(var e,n=1,r=arguments.length;n<r;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])
|
|
4
|
+
;return t},e.apply(this,arguments)}
|
|
5
|
+
;function n(t,e,n,r){
|
|
6
|
+
return new(n||(n=Promise))((function(s,i){
|
|
7
|
+
function o(t){try{c(r.next(t))}catch(t){i(t)}}
|
|
8
|
+
function l(t){try{c(r.throw(t))}catch(t){i(t)}}
|
|
9
|
+
function c(t){var e
|
|
10
|
+
;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){
|
|
11
|
+
t(e)}))).then(o,l)}c((r=r.apply(t,e||[])).next())
|
|
12
|
+
}))}function r(t,e){var n,r,s,i,o={label:0,
|
|
13
|
+
sent:function(){if(1&s[0])throw s[1];return s[1]},
|
|
14
|
+
trys:[],ops:[]};return i={next:l(0),throw:l(1),
|
|
15
|
+
return:l(2)
|
|
16
|
+
},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){
|
|
17
|
+
return this}),i;function l(i){return function(l){
|
|
18
|
+
return function(i){
|
|
19
|
+
if(n)throw new TypeError("Generator is already executing.")
|
|
20
|
+
;for(;o;)try{
|
|
21
|
+
if(n=1,r&&(s=2&i[0]?r.return:i[0]?r.throw||((s=r.return)&&s.call(r),
|
|
22
|
+
0):r.next)&&!(s=s.call(r,i[1])).done)return s
|
|
23
|
+
;switch(r=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:
|
|
24
|
+
case 1:s=i;break;case 4:return o.label++,{
|
|
25
|
+
value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0]
|
|
26
|
+
;continue;case 7:i=o.ops.pop(),o.trys.pop()
|
|
23
27
|
;continue;default:
|
|
24
|
-
if(!(o
|
|
25
|
-
|
|
26
|
-
if(3===
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if(5&
|
|
33
|
-
value:
|
|
34
|
-
function
|
|
35
|
-
if(null==
|
|
36
|
-
;
|
|
37
|
-
setTimeout((function(){
|
|
38
|
-
;return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
;
|
|
28
|
+
if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){
|
|
29
|
+
o=0;continue}
|
|
30
|
+
if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){
|
|
31
|
+
o.label=i[1];break}if(6===i[0]&&o.label<s[1]){
|
|
32
|
+
o.label=s[1],s=i;break}if(s&&o.label<s[2]){
|
|
33
|
+
o.label=s[2],o.ops.push(i);break}
|
|
34
|
+
s[2]&&o.ops.pop(),o.trys.pop();continue}
|
|
35
|
+
i=e.call(t,o)}catch(t){i=[6,t],r=0}finally{n=s=0}
|
|
36
|
+
if(5&i[0])throw i[1];return{
|
|
37
|
+
value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}
|
|
38
|
+
function s(t){
|
|
39
|
+
if(null==t||t<=0)throw new Error("Iterations = ".concat(t))
|
|
40
|
+
;t--;var e=new Promise((function(e){
|
|
41
|
+
setTimeout((function(){e(t)}),1)}))
|
|
42
|
+
;return t<=0?e:e.then(s)}class i extends Error{
|
|
43
|
+
constructor(t,e){
|
|
44
|
+
super(t),Object.setPrototypeOf(this,i.prototype),this.reason=e,
|
|
45
|
+
this.name="AbortError",this._internal=!1}}
|
|
46
|
+
const o=()=>{};class l{constructor(){
|
|
47
|
+
this.aborted=!1,this.reason=void 0,this._callbacks=void 0
|
|
48
|
+
}subscribe(t){var e
|
|
49
|
+
;if(null===(e=this._callbacks)||void 0===e?void 0:e.has(t))throw new Error("Already subscribed: "+t)
|
|
50
|
+
;return this.aborted?(t.call(this,this.reason),
|
|
51
|
+
o):(this._callbacks||(this._callbacks=new Set),
|
|
52
|
+
this._callbacks.add(t),()=>{var e
|
|
53
|
+
;null===(e=this._callbacks)||void 0===e||e.delete(t)
|
|
54
|
+
})}abort(t){var e
|
|
55
|
+
;this.aborted=!0,this.reason=t,null===(e=this._callbacks)||void 0===e||e.forEach((t=>{
|
|
56
|
+
t.call(this,this.reason)})),this._callbacks=void 0
|
|
57
|
+
}throwIfAborted(){
|
|
58
|
+
if(this.aborted)throw this.reason}}class c{
|
|
59
|
+
constructor(){this.signal=new l}abort(t){
|
|
60
|
+
this.signal.aborted||(void 0===t&&((t=new i("Aborted with no reason",t))._internal=!0),
|
|
61
|
+
this.signal.abort(t))}}function u(t,e){return t<e}
|
|
62
|
+
class a{
|
|
63
|
+
constructor({objectPool:t,lessThanFunc:e}={}){
|
|
64
|
+
this._size=0,this._root=null,this.merge=h,
|
|
65
|
+
this.collapse=f,this._objectPool=t,this._lessThanFunc=e||u
|
|
66
|
+
}clear(){this._root=null,this._size=0}get size(){
|
|
67
|
+
return this._size}add(t){
|
|
68
|
+
let e=null!=this._objectPool?this._objectPool.get():null
|
|
69
|
+
;return null==e?e={child:null,next:null,prev:null,
|
|
70
|
+
item:t
|
|
71
|
+
}:e.item=t,this._size++,this._root=h(this._root,e,this._lessThanFunc),e
|
|
72
|
+
}getMin(){const{_root:t}=this
|
|
73
|
+
;return null==t?void 0:t.item}getMinNode(){
|
|
74
|
+
return this._root}deleteMin(){const{_root:t}=this
|
|
75
|
+
;if(null==t)return;const e=t.item
|
|
76
|
+
;return this.delete(t),e}delete(t){var e
|
|
77
|
+
;if(t===this._root)this._root=f(t.child,this._lessThanFunc);else{
|
|
78
|
+
if(null==t.prev){
|
|
79
|
+
if(this._objectPool)throw new Error("The node is already deleted. Don't use the objectPool to prevent this error.")
|
|
80
|
+
;return}
|
|
81
|
+
t.prev.child===t?t.prev.child=t.next:t.prev.next=t.next,null!=t.next&&(t.next.prev=t.prev),
|
|
82
|
+
this._root=h(this._root,f(t.child,this._lessThanFunc),this._lessThanFunc)
|
|
83
|
+
}
|
|
84
|
+
t.child=null,t.prev=null,t.next=null,t.item=void 0,null===(e=this._objectPool)||void 0===e||e.release(t),
|
|
85
|
+
this._size--}decreaseKey(t){
|
|
86
|
+
t!==this._root&&(t.prev.child===t?t.prev.child=t.next:t.prev.next=t.next,
|
|
87
|
+
null!=t.next&&(t.next.prev=t.prev),
|
|
88
|
+
this._root=h(this._root,t,this._lessThanFunc))}
|
|
89
|
+
get isEmpty(){return null==this._root}
|
|
90
|
+
[Symbol.iterator](){return this._iterate(!1)}
|
|
91
|
+
nodes(){return{
|
|
92
|
+
[Symbol.iterator]:()=>this._iterate(!0)}}
|
|
93
|
+
_iterate(t){const e=this._lessThanFunc
|
|
94
|
+
;return function*n(r){
|
|
95
|
+
r&&(t?yield r:yield r.item,r.child&&(null!=r.child.next&&(r.child=f(r.child,e),
|
|
96
|
+
r.child.prev=r),yield*n(r.child)))}(this._root)}}
|
|
97
|
+
function h(t,e,n){let r,s
|
|
98
|
+
;return null==t?e:null==e||t===e?t:(n(e.item,t.item)?(r=e,
|
|
99
|
+
s=t):(r=t,s=e),s.next=r.child,
|
|
100
|
+
null!=r.child&&(r.child.prev=s),s.prev=r,r.child=s,
|
|
101
|
+
r.next=null,r.prev=null,r)}function f(t,e){
|
|
102
|
+
let n,r,s,i,o;if(null==t)return null
|
|
103
|
+
;for(i=t,n=null;null!=i;){
|
|
104
|
+
if(r=i,s=r.next,null==s){r.prev=n,n=r;break}
|
|
105
|
+
i=s.next,o=h(r,s,e),o.prev=n,n=o}
|
|
106
|
+
for(o=null;null!=n;)i=n.prev,o=h(o,n,e),n=i
|
|
107
|
+
;return o}function d(t,e){t(function(t){return{
|
|
108
|
+
then(e,n){n(t)}}}(e))}function _(t){
|
|
109
|
+
return null!=t&&"object"==typeof t&&"function"==typeof t.then
|
|
110
|
+
}let v,b=[];function p(t){
|
|
111
|
+
b.push(t),v||(v=function(){
|
|
112
|
+
return n(this,void 0,void 0,(function*(){
|
|
113
|
+
for(;b.length>0;){yield 0;const t=b
|
|
114
|
+
;b=[],t.forEach((t=>{try{t()}catch(t){
|
|
115
|
+
console.error("Unhandled promise rejection",t)}}))
|
|
116
|
+
}v=null}))}())}function y(t,e,n){p((()=>{try{
|
|
117
|
+
const r=e?e(t):t;n._resolve(r)}catch(t){
|
|
118
|
+
n._reject(t)}}))}function w(t,e,n){p((()=>{
|
|
119
|
+
if(e)try{const r=e(t);n._resolve(r)}catch(t){
|
|
120
|
+
n._reject(t)}else n._reject(t)}))}
|
|
121
|
+
const g=function(){};class m{constructor(t){
|
|
122
|
+
this.status="pending",this.value=void 0,
|
|
123
|
+
this.reason=void 0,this._handlers=null
|
|
124
|
+
;const e=this._resolve,n=this._reject,r=this._resolveAsync,s=this._rejectAsync,i=this
|
|
125
|
+
;this._resolve=function(t){e.call(i,t)
|
|
126
|
+
},this._reject=function(t){n.call(i,t)
|
|
127
|
+
},this._resolveAsync=function(t){r.call(i,t)
|
|
128
|
+
},this._rejectAsync=function(t){s.call(i,t)
|
|
129
|
+
},t(this._resolve,this._reject)}_resolve(t){
|
|
130
|
+
"pending"===this.status&&(this.status="fulfilled",
|
|
131
|
+
this._resolveAsync(t))}_resolveAsync(t){
|
|
132
|
+
_(t)?t.then(this._resolveAsync,this._rejectAsync):this._resolveSync(t)
|
|
133
|
+
}_resolveSync(t){const e=this._handlers
|
|
134
|
+
;if(this.value=t,null!=e){this._handlers=null
|
|
135
|
+
;for(let n=0,r=e.length;n<r;n++){const[r,,s]=e[n]
|
|
136
|
+
;y(t,r,s)}}}_reject(t){
|
|
137
|
+
"pending"===this.status&&this._rejectAsync(t)}
|
|
138
|
+
_rejectAsync(t){
|
|
139
|
+
this.status="rejected",_(t)?t.then(this._rejectAsync,this._rejectAsync):this._rejectSync(t)
|
|
140
|
+
}_rejectSync(t){const e=this._handlers
|
|
141
|
+
;if(this.reason=t,null!=e){this._handlers=null
|
|
142
|
+
;for(let n=0,r=e.length;n<r;n++){const[,r,s]=e[n]
|
|
143
|
+
;w(t,r,s)}}}then(t,e){const n=new m(g)
|
|
144
|
+
;return"pending"===this.status?(null==this._handlers&&(this._handlers=[]),
|
|
145
|
+
this._handlers.push([t,e,n])):"fulfilled"===this.status?y(this.value,t,n):w(this.reason,e,n),
|
|
146
|
+
n}catch(t){return this.then(void 0,t)}finally(t){
|
|
147
|
+
const e=t&&function(e){const n=t()
|
|
148
|
+
;return _(n)?n.then((()=>e)):m.resolve(e)
|
|
149
|
+
},n=t&&function(e){const n=t()
|
|
150
|
+
;return _(n)?n.then((()=>m.reject(e))):m.reject(e)
|
|
151
|
+
};return this.then(e,n)}static resolve(t){
|
|
152
|
+
const e=new m(g);return e._resolve(t),e}
|
|
153
|
+
static reject(t){const e=new m(g)
|
|
154
|
+
;return e._reject(t),e}get[Symbol.toStringTag](){
|
|
155
|
+
return"Promise"}static get[Symbol.species](){
|
|
156
|
+
return m}static all(t){return function(t,e){
|
|
157
|
+
let n,r;e||(e=Promise);const s=new e(((t,e)=>{
|
|
158
|
+
n=t,r=e}));let i=t.length;const o=[]
|
|
159
|
+
;return t.forEach(((t,e)=>{_(t)?t.then((t=>{
|
|
160
|
+
o[e]=t,0==--i&&n(o)}),r):(o[e]=t,0==--i&&n(o))
|
|
161
|
+
})),s}(t,m)}static allSettled(t){
|
|
162
|
+
return function(t,e){let n;e||(e=Promise)
|
|
163
|
+
;const r=new e(((t,e)=>{n=t}));let s=t.length
|
|
164
|
+
;const i=[];return t.forEach(((t,e)=>{
|
|
165
|
+
_(t)?t.then((t=>{i[e]={status:"fulfilled",value:t
|
|
166
|
+
},0==--s&&n(i)}),(t=>{i[e]={status:"rejected",
|
|
167
|
+
reason:t},0==--s&&n(i)})):(i[e]={
|
|
168
|
+
status:"fulfilled",value:t},0==--s&&n(i))})),r
|
|
169
|
+
}(t,m)}static any(t){return function(t,e){let n,r
|
|
170
|
+
;e||(e=Promise);const s=new e(((t,e)=>{n=t,r=e}))
|
|
171
|
+
;let i=t.length;const o=[]
|
|
172
|
+
;return t.forEach(((t,e)=>{_(t)?t.then(n,(t=>{
|
|
173
|
+
o[e]=t,0==--i&&r(new AggregateError(o))})):n(t)
|
|
174
|
+
})),s}(t,m)}static race(t){return function(t,e){
|
|
175
|
+
let n,r;e||(e=Promise);const s=new e(((t,e)=>{
|
|
176
|
+
n=t,r=e}));return t.forEach((t=>{
|
|
177
|
+
_(t)?t.then(n,r):n(t)})),s}(t,m)}}
|
|
178
|
+
const j=function(){};class x{constructor(t){
|
|
179
|
+
if(this._status="pending",t&&t.aborted)this.promise=m.reject(t.reason),
|
|
180
|
+
this.resolve=j,this.reject=j;else{let e,n
|
|
181
|
+
;if(this.promise=new Promise((function(t){
|
|
182
|
+
e=t,n=function(e){d(t,e)}})),t){
|
|
183
|
+
const r=t.subscribe((function(t){n(t)}))
|
|
184
|
+
;this.resolve=function(t){r(),e(t)
|
|
185
|
+
},this.reject=function(t){r(),n(t)}
|
|
186
|
+
}else this.resolve=e,this.reject=n}
|
|
187
|
+
this.promise.then((()=>{this._status="resolved"
|
|
188
|
+
}),(()=>{this._status="rejected"}))}get state(){
|
|
189
|
+
return this._status}}class P{constructor(t,e){
|
|
190
|
+
this._branch=null,this.order=t,this.parent=e}
|
|
191
|
+
get branch(){if(!this._branch){
|
|
192
|
+
const t=[this.order];let e=this.parent
|
|
193
|
+
;for(;null!=e;)t.push(e.order),e=e.parent
|
|
194
|
+
;this._branch=t}return this._branch}}
|
|
195
|
+
function S(t,e){return function(t,e){
|
|
196
|
+
const n=t&&t.branch,r=e&&e.branch,s=n?n.length:0,i=r?r.length:0,o=s>i?s:i
|
|
197
|
+
;for(let t=0;t<o;t++){
|
|
198
|
+
const e=t>=s?0:n[s-1-t],o=t>=i?0:r[i-1-t]
|
|
199
|
+
;if(e!==o)return e>o?1:-1}return 0
|
|
200
|
+
}(t.priority,e.priority)<0}let k=1;class z{
|
|
201
|
+
constructor(){this._queue=new a({lessThanFunc:S})}
|
|
202
|
+
run(t,e,n){return this._run(!1,t,e,n)}
|
|
203
|
+
runTask(t,e,n){return this._run(!0,t,e,n)}
|
|
204
|
+
_run(t,e,n,r){const s=new x(r),i={
|
|
205
|
+
priority:(o=k++,l=n,null==o?null==l?null:l:new P(o,l)),
|
|
206
|
+
func:e,abortSignal:r,resolve:s.resolve,
|
|
207
|
+
reject:s.reject,readyToRun:!t};var o,l
|
|
208
|
+
;if(this._queue.add(i),t){const t=this;return{
|
|
209
|
+
result:s.promise,setReadyToRun(e){
|
|
210
|
+
i.readyToRun=e,e&&!t._inProcess&&(t._inProcess=!0,
|
|
211
|
+
t._process())}}}
|
|
212
|
+
return this._inProcess||(this._inProcess=!0,this._process()),s.promise
|
|
213
|
+
}_process(){
|
|
214
|
+
return n(this,void 0,void 0,(function*(){
|
|
215
|
+
const t=this._queue;for(;;){if(yield 0,t.isEmpty){
|
|
216
|
+
this._inProcess=!1;break}let e=t.getMin()
|
|
217
|
+
;if(e.readyToRun)t.deleteMin();else{let n
|
|
218
|
+
;for(const e of t.nodes())if(e.item.readyToRun){
|
|
219
|
+
n=e;break}if(!n){this._inProcess=!1;break}
|
|
220
|
+
e=n.item,t.delete(n)}
|
|
221
|
+
if(e.abortSignal&&e.abortSignal.aborted)e.reject(e.abortSignal.reason);else try{
|
|
222
|
+
let t=e.func&&e.func(e.abortSignal)
|
|
223
|
+
;t&&"function"==typeof t.then&&(t=yield t),e.resolve(t)
|
|
224
|
+
}catch(t){e.reject(t)}}}))}}const E=function(){
|
|
225
|
+
const t=new z;return function(e,n){
|
|
226
|
+
return t.run(void 0,e,n)}}();class T{
|
|
227
|
+
constructor(t){
|
|
228
|
+
if(this._maxSize=0,this._size=0,this._tickPromise=new x,!t)throw new Error("maxSize should be > 0")
|
|
229
|
+
;this._maxSize=t,
|
|
230
|
+
this._size=t,this._priorityQueue=new z}
|
|
231
|
+
get maxSize(){return this._maxSize}get size(){
|
|
232
|
+
return this._size}get holdAvailable(){
|
|
233
|
+
return this._size}hold(t){const e=this._size
|
|
234
|
+
;return!(t>e)&&(this._size=e-t,!0)}
|
|
235
|
+
get releaseAvailable(){
|
|
236
|
+
return this.maxSize-this._size}release(t,e){
|
|
237
|
+
const n=this._size,r=this.maxSize-n;if(t>r){
|
|
238
|
+
if(!e)throw new Error(`count (${t} > maxReleaseCount (${r}))`)
|
|
239
|
+
;t=r}if(t>0&&(this._size=n+t,this._tickPromise)){
|
|
240
|
+
const t=this._tickPromise
|
|
241
|
+
;this._tickPromise=null,t.resolve()}return t}
|
|
242
|
+
tick(t){
|
|
243
|
+
if(!(this._size>=this._maxSize))return this._tickPromise||(this._tickPromise=new x),
|
|
244
|
+
function(t,e){return t?new Promise((function(n){
|
|
245
|
+
if(t&&t.aborted)return void d(n,t.reason);let r,s
|
|
246
|
+
;function i(t){s||(s=!0,r&&r(),d(n,t))}
|
|
247
|
+
e.then((function(t){r&&r(),n(t)
|
|
248
|
+
})).catch(i),t&&(r=t.subscribe(i))})):e
|
|
249
|
+
}(t,this._tickPromise.promise)}holdWait(t,e,r,s){
|
|
250
|
+
if(t>this.maxSize)throw new Error(`holdCount (${t} > maxSize (${this.maxSize}))`)
|
|
251
|
+
;return s||(s=E),
|
|
252
|
+
this._priorityQueue.run((r=>n(this,void 0,void 0,(function*(){
|
|
253
|
+
for(;t>this._size;)yield this.tick(r),yield s(e,r)
|
|
254
|
+
;if(!this.hold(t))throw new Error("Unexpected behavior")
|
|
255
|
+
}))),e,r)}}t.createTestVariants=function(t){
|
|
256
|
+
return function(i){return function(o){
|
|
257
|
+
var l=void 0===o?{}:o,u=l.GC_Iterations,a=void 0===u?1e6:u,h=l.GC_IterationsAsync,f=void 0===h?1e4:h,d=l.GC_Interval,_=void 0===d?1e3:d,v=l.logInterval,b=void 0===v?5e3:v,p=l.logCompleted,y=void 0===p||p,w=l.onError,g=void 0===w?null:w,m=l.abortSignal,j=void 0===m?null:m,x=l.parallel,P=new c,S=function(...t){
|
|
258
|
+
let e,n;function r(t){e.abort(t)}
|
|
259
|
+
for(let s=0;s<t.length;s++){const i=t[s];if(i){
|
|
260
|
+
if(i.aborted){r.call(i);break}
|
|
261
|
+
n?(e||(e=new c,n.subscribe(r)),i.subscribe(r)):n=i
|
|
262
|
+
}}return e?e.signal:n||(new c).signal
|
|
263
|
+
}(j,P.signal),k=S,z=Object.keys(i),E=Object.values(i),A=z.length,O={}
|
|
264
|
+
;function F(t){var e=E[t]
|
|
265
|
+
;return"function"==typeof e&&(e=e(O)),e}
|
|
266
|
+
for(var I=[],R=[],C=0;C<A;C++)I[C]=-1,R[C]=[]
|
|
267
|
+
;R[0]=F(0);var D=0,M=0,G=!1,$=0;function q(t,e,s){
|
|
46
268
|
return n(this,void 0,void 0,(function(){var n
|
|
47
|
-
;return
|
|
269
|
+
;return r(this,(function(r){switch(r.label){
|
|
48
270
|
case 0:
|
|
49
|
-
return console.error("error variant: ".concat(
|
|
50
|
-
console.error(
|
|
51
|
-
n=Date.now(),Date.now()-n>50
|
|
52
|
-
|
|
53
|
-
;case 2:throw
|
|
54
|
-
}),
|
|
55
|
-
|
|
271
|
+
return P.abort(t),console.error("error variant: ".concat(e,"\r\n").concat(JSON.stringify(s,null,2))),
|
|
272
|
+
console.error(t),
|
|
273
|
+
n=Date.now(),Date.now()-n>50&&$<5?(console.log("DEBUG ITERATION: "+$),
|
|
274
|
+
G=!0,[4,K()]):[3,2];case 1:r.sent(),$++,r.label=2
|
|
275
|
+
;case 2:throw g&&g({iteration:e,variant:s,error:t
|
|
276
|
+
}),t}}))}))}
|
|
277
|
+
var N=Date.now(),U=N,W=D,Q=M,B=null==x||x<=1?null:new T(x)
|
|
278
|
+
;function J(e,s,i){
|
|
279
|
+
return n(this,void 0,void 0,(function(){var n,o,l
|
|
280
|
+
;return r(this,(function(r){switch(r.label){
|
|
281
|
+
case 0:return r.trys.push([0,3,,5]),function(t){
|
|
282
|
+
return"object"==typeof t&&t&&"function"==typeof t.then
|
|
283
|
+
}(n=t(s,i))?[4,n]:[3,2];case 1:
|
|
284
|
+
return o=r.sent(),M+=l="number"==typeof o?o:1,D+=l,
|
|
285
|
+
[2];case 2:return D+="number"==typeof n?n:1,[3,5]
|
|
286
|
+
;case 3:return[4,q(r.sent(),e,s)];case 4:
|
|
287
|
+
return r.sent(),[3,5];case 5:return[2]}}))}))}
|
|
288
|
+
function K(){
|
|
56
289
|
return n(this,void 0,void 0,(function(){
|
|
57
|
-
var
|
|
58
|
-
switch(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
return
|
|
73
|
-
;case
|
|
74
|
-
|
|
75
|
-
;case
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
;
|
|
79
|
-
|
|
290
|
+
var t,i=this;return r(this,(function(o){
|
|
291
|
+
switch(o.label){case 0:t=function(){var t,o,l
|
|
292
|
+
;return r(this,(function(c){switch(c.label){
|
|
293
|
+
case 0:
|
|
294
|
+
return t=D,o=B?e({},O):O,l=(b||_)&&Date.now(),b&&l-N>=b&&(console.log(D),
|
|
295
|
+
N=l),a&&D-W>=a||f&&M-Q>=f||_&&l-U>=_?(W=D,
|
|
296
|
+
Q=M,U=l,[4,s(1)]):[3,2];case 1:
|
|
297
|
+
return c.sent(),[2,"continue"];case 2:
|
|
298
|
+
return(null==j?void 0:j.aborted)?[2,"continue"]:B&&!S.aborted?[3,4]:[4,J(t,o,j)]
|
|
299
|
+
;case 3:return c.sent(),[3,7];case 4:
|
|
300
|
+
return B.hold(1)?[3,6]:[4,B.holdWait(1)];case 5:
|
|
301
|
+
c.sent(),c.label=6;case 6:
|
|
302
|
+
n(i,void 0,void 0,(function(){
|
|
303
|
+
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,J(t,o,S)]
|
|
305
|
+
;case 1:return e.sent(),[3,3];case 2:
|
|
306
|
+
return B.release(1),[7];case 3:return[2]}}))
|
|
307
|
+
})),c.label=7;case 7:return[2]}}))},o.label=1
|
|
308
|
+
;case 1:
|
|
309
|
+
return(null==j?void 0:j.aborted)||!G&&!function(){
|
|
310
|
+
for(var t=A-1;t>=0;t--){var e=I[t]+1
|
|
311
|
+
;if(e<R[t].length){
|
|
312
|
+
for(I[t]=e,O[z[t]]=R[t][e],t++;t<A;t++){var n=F(t)
|
|
313
|
+
;if(0===n.length)break;I[t]=0,R[t]=n,O[z[t]]=n[0]}
|
|
314
|
+
if(t>=A)return!0}}return!1}()?[3,3]:[5,t()]
|
|
315
|
+
;case 2:return o.sent(),[3,1];case 3:
|
|
316
|
+
return B?[4,B.holdWait(x)]:[3,5];case 4:
|
|
317
|
+
o.sent(),B.release(x),o.label=5;case 5:
|
|
318
|
+
if(null==k?void 0:k.aborted)throw k.reason
|
|
319
|
+
;return y&&console.log("variants: "+D),[4,s(1)]
|
|
320
|
+
;case 6:return o.sent(),[2,D]}}))}))}return K()}}
|
|
321
|
+
},Object.defineProperty(t,"__esModule",{value:!0})
|
|
80
322
|
}({});
|
package/dist/lib/index.cjs
CHANGED
|
@@ -5,6 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var testVariants_createTestVariants = require('./test-variants/createTestVariants.cjs');
|
|
6
6
|
require('tslib');
|
|
7
7
|
require('./garbage-collect/garbageCollect.cjs');
|
|
8
|
+
require('@flemist/abort-controller-fast');
|
|
9
|
+
require('@flemist/time-limits');
|
|
10
|
+
require('@flemist/async-utils');
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
|
package/dist/lib/index.mjs
CHANGED
|
@@ -4,11 +4,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var garbageCollect_garbageCollect = require('../garbage-collect/garbageCollect.cjs');
|
|
7
|
+
var abortControllerFast = require('@flemist/abort-controller-fast');
|
|
8
|
+
var timeLimits = require('@flemist/time-limits');
|
|
9
|
+
var asyncUtils = require('@flemist/async-utils');
|
|
7
10
|
|
|
8
11
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
12
|
+
function isPromiseLike(value) {
|
|
13
|
+
return typeof value === 'object'
|
|
14
|
+
&& value
|
|
15
|
+
&& typeof value.then === 'function';
|
|
16
|
+
}
|
|
9
17
|
function createTestVariants(test) {
|
|
10
18
|
return function testVariantsArgs(args) {
|
|
11
|
-
return function testVariantsCall({ GC_Iterations = 1000000, GC_IterationsAsync = 10000, GC_Interval = 1000, logInterval = 5000, logCompleted = true, onError: onErrorCallback = null, abortSignal, } = {}) {
|
|
19
|
+
return function testVariantsCall({ GC_Iterations = 1000000, GC_IterationsAsync = 10000, GC_Interval = 1000, logInterval = 5000, logCompleted = true, onError: onErrorCallback = null, abortSignal: abortSignalExternal = null, parallel, } = {}) {
|
|
20
|
+
const abortControllerParallel = new abortControllerFast.AbortControllerFast();
|
|
21
|
+
const abortSignalParallel = asyncUtils.combineAbortSignals(abortSignalExternal, abortControllerParallel.signal);
|
|
22
|
+
const abortSignalAll = abortSignalParallel;
|
|
12
23
|
const argsKeys = Object.keys(args);
|
|
13
24
|
const argsValues = Object.values(args);
|
|
14
25
|
const argsLength = argsKeys.length;
|
|
@@ -53,8 +64,9 @@ function createTestVariants(test) {
|
|
|
53
64
|
let iterationsAsync = 0;
|
|
54
65
|
let debug = false;
|
|
55
66
|
let debugIteration = 0;
|
|
56
|
-
function onError(error) {
|
|
67
|
+
function onError(error, iterations, variantArgs) {
|
|
57
68
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
abortControllerParallel.abort(error);
|
|
58
70
|
console.error(`error variant: ${iterations}\r\n${JSON.stringify(variantArgs, null, 2)}`);
|
|
59
71
|
console.error(error);
|
|
60
72
|
// rerun failed variant 5 times for debug
|
|
@@ -86,43 +98,78 @@ function createTestVariants(test) {
|
|
|
86
98
|
let prevGC_Time = prevLogTime;
|
|
87
99
|
let prevGC_Iterations = iterations;
|
|
88
100
|
let prevGC_IterationsAsync = iterationsAsync;
|
|
89
|
-
|
|
101
|
+
const pool = parallel == null || parallel <= 1
|
|
102
|
+
? null
|
|
103
|
+
: new timeLimits.Pool(parallel);
|
|
104
|
+
function runTest(_iterations, variantArgs, abortSignal) {
|
|
90
105
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
91
106
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (GC_Iterations && iterations - prevGC_Iterations >= GC_Iterations
|
|
100
|
-
|| GC_IterationsAsync && iterationsAsync - prevGC_IterationsAsync >= GC_IterationsAsync
|
|
101
|
-
|| GC_Interval && now - prevGC_Time >= GC_Interval) {
|
|
102
|
-
prevGC_Iterations = iterations;
|
|
103
|
-
prevGC_IterationsAsync = iterationsAsync;
|
|
104
|
-
prevGC_Time = now;
|
|
105
|
-
yield garbageCollect_garbageCollect.garbageCollect(1);
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
const promiseOrIterations = test(variantArgs);
|
|
109
|
-
if (typeof promiseOrIterations === 'object'
|
|
110
|
-
&& promiseOrIterations
|
|
111
|
-
&& typeof promiseOrIterations.then === 'function') {
|
|
112
|
-
const value = yield promiseOrIterations;
|
|
113
|
-
const newIterations = typeof value === 'number' ? value : 1;
|
|
114
|
-
iterationsAsync += newIterations;
|
|
115
|
-
iterations += newIterations;
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
iterations += typeof promiseOrIterations === 'number' ? promiseOrIterations : 1;
|
|
107
|
+
const promiseOrIterations = test(variantArgs, abortSignal);
|
|
108
|
+
if (isPromiseLike(promiseOrIterations)) {
|
|
109
|
+
const value = yield promiseOrIterations;
|
|
110
|
+
const newIterations = typeof value === 'number' ? value : 1;
|
|
111
|
+
iterationsAsync += newIterations;
|
|
112
|
+
iterations += newIterations;
|
|
113
|
+
return;
|
|
119
114
|
}
|
|
115
|
+
iterations += typeof promiseOrIterations === 'number' ? promiseOrIterations : 1;
|
|
120
116
|
}
|
|
121
117
|
catch (err) {
|
|
122
|
-
yield onError(err);
|
|
118
|
+
yield onError(err, _iterations, variantArgs);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function next() {
|
|
123
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
while (!(abortSignalExternal === null || abortSignalExternal === void 0 ? void 0 : abortSignalExternal.aborted) && (debug || nextVariant())) {
|
|
125
|
+
const _iterations = iterations;
|
|
126
|
+
const _variantArgs = !pool
|
|
127
|
+
? variantArgs
|
|
128
|
+
: Object.assign({}, variantArgs);
|
|
129
|
+
const now = (logInterval || GC_Interval) && Date.now();
|
|
130
|
+
if (logInterval && now - prevLogTime >= logInterval) {
|
|
131
|
+
// the log is required to prevent the karma browserNoActivityTimeout
|
|
132
|
+
console.log(iterations);
|
|
133
|
+
prevLogTime = now;
|
|
134
|
+
}
|
|
135
|
+
if (GC_Iterations && iterations - prevGC_Iterations >= GC_Iterations
|
|
136
|
+
|| GC_IterationsAsync && iterationsAsync - prevGC_IterationsAsync >= GC_IterationsAsync
|
|
137
|
+
|| GC_Interval && now - prevGC_Time >= GC_Interval) {
|
|
138
|
+
prevGC_Iterations = iterations;
|
|
139
|
+
prevGC_IterationsAsync = iterationsAsync;
|
|
140
|
+
prevGC_Time = now;
|
|
141
|
+
yield garbageCollect_garbageCollect.garbageCollect(1);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (abortSignalExternal === null || abortSignalExternal === void 0 ? void 0 : abortSignalExternal.aborted) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (!pool || abortSignalParallel.aborted) {
|
|
148
|
+
yield runTest(_iterations, _variantArgs, abortSignalExternal);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
if (!pool.hold(1)) {
|
|
152
|
+
yield pool.holdWait(1);
|
|
153
|
+
}
|
|
154
|
+
void (() => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
try {
|
|
156
|
+
if (abortSignalParallel === null || abortSignalParallel === void 0 ? void 0 : abortSignalParallel.aborted) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
yield runTest(_iterations, _variantArgs, abortSignalParallel);
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
void pool.release(1);
|
|
163
|
+
}
|
|
164
|
+
}))();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (pool) {
|
|
168
|
+
yield pool.holdWait(parallel);
|
|
169
|
+
void pool.release(parallel);
|
|
123
170
|
}
|
|
124
|
-
if (
|
|
125
|
-
throw
|
|
171
|
+
if (abortSignalAll === null || abortSignalAll === void 0 ? void 0 : abortSignalAll.aborted) {
|
|
172
|
+
throw abortSignalAll.reason;
|
|
126
173
|
}
|
|
127
174
|
onCompleted();
|
|
128
175
|
yield garbageCollect_garbageCollect.garbageCollect(1);
|
|
@@ -26,5 +26,5 @@ export declare type TestVariantsCallParams<TArgs> = {
|
|
|
26
26
|
abortSignal?: IAbortSignalFast;
|
|
27
27
|
parallel?: number;
|
|
28
28
|
};
|
|
29
|
-
export declare function createTestVariants<TArgs extends object>(test: (args: TArgs) => Promise<number | void> | number | void): TestVariantsSetArgs<TArgs>;
|
|
29
|
+
export declare function createTestVariants<TArgs extends object>(test: (args: TArgs, abortSignal: IAbortSignalFast) => Promise<number | void> | number | void): TestVariantsSetArgs<TArgs>;
|
|
30
30
|
export {};
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import { garbageCollect } from '../garbage-collect/garbageCollect.mjs';
|
|
3
|
+
import { AbortControllerFast } from '@flemist/abort-controller-fast';
|
|
4
|
+
import { Pool } from '@flemist/time-limits';
|
|
5
|
+
import { combineAbortSignals } from '@flemist/async-utils';
|
|
3
6
|
|
|
4
7
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
8
|
+
function isPromiseLike(value) {
|
|
9
|
+
return typeof value === 'object'
|
|
10
|
+
&& value
|
|
11
|
+
&& typeof value.then === 'function';
|
|
12
|
+
}
|
|
5
13
|
function createTestVariants(test) {
|
|
6
14
|
return function testVariantsArgs(args) {
|
|
7
|
-
return function testVariantsCall({ GC_Iterations = 1000000, GC_IterationsAsync = 10000, GC_Interval = 1000, logInterval = 5000, logCompleted = true, onError: onErrorCallback = null, abortSignal, } = {}) {
|
|
15
|
+
return function testVariantsCall({ GC_Iterations = 1000000, GC_IterationsAsync = 10000, GC_Interval = 1000, logInterval = 5000, logCompleted = true, onError: onErrorCallback = null, abortSignal: abortSignalExternal = null, parallel, } = {}) {
|
|
16
|
+
const abortControllerParallel = new AbortControllerFast();
|
|
17
|
+
const abortSignalParallel = combineAbortSignals(abortSignalExternal, abortControllerParallel.signal);
|
|
18
|
+
const abortSignalAll = abortSignalParallel;
|
|
8
19
|
const argsKeys = Object.keys(args);
|
|
9
20
|
const argsValues = Object.values(args);
|
|
10
21
|
const argsLength = argsKeys.length;
|
|
@@ -49,8 +60,9 @@ function createTestVariants(test) {
|
|
|
49
60
|
let iterationsAsync = 0;
|
|
50
61
|
let debug = false;
|
|
51
62
|
let debugIteration = 0;
|
|
52
|
-
function onError(error) {
|
|
63
|
+
function onError(error, iterations, variantArgs) {
|
|
53
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
abortControllerParallel.abort(error);
|
|
54
66
|
console.error(`error variant: ${iterations}\r\n${JSON.stringify(variantArgs, null, 2)}`);
|
|
55
67
|
console.error(error);
|
|
56
68
|
// rerun failed variant 5 times for debug
|
|
@@ -82,43 +94,78 @@ function createTestVariants(test) {
|
|
|
82
94
|
let prevGC_Time = prevLogTime;
|
|
83
95
|
let prevGC_Iterations = iterations;
|
|
84
96
|
let prevGC_IterationsAsync = iterationsAsync;
|
|
85
|
-
|
|
97
|
+
const pool = parallel == null || parallel <= 1
|
|
98
|
+
? null
|
|
99
|
+
: new Pool(parallel);
|
|
100
|
+
function runTest(_iterations, variantArgs, abortSignal) {
|
|
86
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
102
|
try {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (GC_Iterations && iterations - prevGC_Iterations >= GC_Iterations
|
|
96
|
-
|| GC_IterationsAsync && iterationsAsync - prevGC_IterationsAsync >= GC_IterationsAsync
|
|
97
|
-
|| GC_Interval && now - prevGC_Time >= GC_Interval) {
|
|
98
|
-
prevGC_Iterations = iterations;
|
|
99
|
-
prevGC_IterationsAsync = iterationsAsync;
|
|
100
|
-
prevGC_Time = now;
|
|
101
|
-
yield garbageCollect(1);
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
const promiseOrIterations = test(variantArgs);
|
|
105
|
-
if (typeof promiseOrIterations === 'object'
|
|
106
|
-
&& promiseOrIterations
|
|
107
|
-
&& typeof promiseOrIterations.then === 'function') {
|
|
108
|
-
const value = yield promiseOrIterations;
|
|
109
|
-
const newIterations = typeof value === 'number' ? value : 1;
|
|
110
|
-
iterationsAsync += newIterations;
|
|
111
|
-
iterations += newIterations;
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
iterations += typeof promiseOrIterations === 'number' ? promiseOrIterations : 1;
|
|
103
|
+
const promiseOrIterations = test(variantArgs, abortSignal);
|
|
104
|
+
if (isPromiseLike(promiseOrIterations)) {
|
|
105
|
+
const value = yield promiseOrIterations;
|
|
106
|
+
const newIterations = typeof value === 'number' ? value : 1;
|
|
107
|
+
iterationsAsync += newIterations;
|
|
108
|
+
iterations += newIterations;
|
|
109
|
+
return;
|
|
115
110
|
}
|
|
111
|
+
iterations += typeof promiseOrIterations === 'number' ? promiseOrIterations : 1;
|
|
116
112
|
}
|
|
117
113
|
catch (err) {
|
|
118
|
-
yield onError(err);
|
|
114
|
+
yield onError(err, _iterations, variantArgs);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function next() {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
while (!(abortSignalExternal === null || abortSignalExternal === void 0 ? void 0 : abortSignalExternal.aborted) && (debug || nextVariant())) {
|
|
121
|
+
const _iterations = iterations;
|
|
122
|
+
const _variantArgs = !pool
|
|
123
|
+
? variantArgs
|
|
124
|
+
: Object.assign({}, variantArgs);
|
|
125
|
+
const now = (logInterval || GC_Interval) && Date.now();
|
|
126
|
+
if (logInterval && now - prevLogTime >= logInterval) {
|
|
127
|
+
// the log is required to prevent the karma browserNoActivityTimeout
|
|
128
|
+
console.log(iterations);
|
|
129
|
+
prevLogTime = now;
|
|
130
|
+
}
|
|
131
|
+
if (GC_Iterations && iterations - prevGC_Iterations >= GC_Iterations
|
|
132
|
+
|| GC_IterationsAsync && iterationsAsync - prevGC_IterationsAsync >= GC_IterationsAsync
|
|
133
|
+
|| GC_Interval && now - prevGC_Time >= GC_Interval) {
|
|
134
|
+
prevGC_Iterations = iterations;
|
|
135
|
+
prevGC_IterationsAsync = iterationsAsync;
|
|
136
|
+
prevGC_Time = now;
|
|
137
|
+
yield garbageCollect(1);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (abortSignalExternal === null || abortSignalExternal === void 0 ? void 0 : abortSignalExternal.aborted) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (!pool || abortSignalParallel.aborted) {
|
|
144
|
+
yield runTest(_iterations, _variantArgs, abortSignalExternal);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
if (!pool.hold(1)) {
|
|
148
|
+
yield pool.holdWait(1);
|
|
149
|
+
}
|
|
150
|
+
void (() => __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
try {
|
|
152
|
+
if (abortSignalParallel === null || abortSignalParallel === void 0 ? void 0 : abortSignalParallel.aborted) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
yield runTest(_iterations, _variantArgs, abortSignalParallel);
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
void pool.release(1);
|
|
159
|
+
}
|
|
160
|
+
}))();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (pool) {
|
|
164
|
+
yield pool.holdWait(parallel);
|
|
165
|
+
void pool.release(parallel);
|
|
119
166
|
}
|
|
120
|
-
if (
|
|
121
|
-
throw
|
|
167
|
+
if (abortSignalAll === null || abortSignalAll === void 0 ? void 0 : abortSignalAll.aborted) {
|
|
168
|
+
throw abortSignalAll.reason;
|
|
122
169
|
}
|
|
123
170
|
onCompleted();
|
|
124
171
|
yield garbageCollect(1);
|
|
@@ -4,6 +4,9 @@ var rdtsc = require('rdtsc');
|
|
|
4
4
|
var testVariants_createTestVariants = require('./createTestVariants.cjs');
|
|
5
5
|
require('tslib');
|
|
6
6
|
require('../garbage-collect/garbageCollect.cjs');
|
|
7
|
+
require('@flemist/abort-controller-fast');
|
|
8
|
+
require('@flemist/time-limits');
|
|
9
|
+
require('@flemist/async-utils');
|
|
7
10
|
|
|
8
11
|
describe('test > testVariants perf', function () {
|
|
9
12
|
this.timeout(300000);
|
|
@@ -2,6 +2,9 @@ import { calcPerformance } from 'rdtsc';
|
|
|
2
2
|
import { createTestVariants } from './createTestVariants.mjs';
|
|
3
3
|
import 'tslib';
|
|
4
4
|
import '../garbage-collect/garbageCollect.mjs';
|
|
5
|
+
import '@flemist/abort-controller-fast';
|
|
6
|
+
import '@flemist/time-limits';
|
|
7
|
+
import '@flemist/async-utils';
|
|
5
8
|
|
|
6
9
|
describe('test > testVariants perf', function () {
|
|
7
10
|
this.timeout(300000);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemist/test-variants",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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",
|
|
@@ -32,23 +32,6 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"_prepublishOnly": "pnpm run audit && pnpm run lint && pnpm run build && pnpm run test:mocha:ci && pnpm run test:karma",
|
|
37
|
-
"audit": "pnpm audit --prod",
|
|
38
|
-
"lint": "eslint ./**/*.{js,cjs,mjs,ts,tsx}",
|
|
39
|
-
"lint:fix": "eslint --fix ./**/*.{js,cjs,mjs,ts,tsx}",
|
|
40
|
-
"lint:wizard": "eslint-nibble --cache --multi ./**/*.{js,cjs,mjs,ts,tsx}",
|
|
41
|
-
"build:js": "rimraf dist/lib && cpy \"**/assets/**\" \"**/*.{js,cjs,mjs}\" \"../dist/lib/\" --parents --cwd=src && rollup -c",
|
|
42
|
-
"build": "rimraf dist && pnpm run build:js",
|
|
43
|
-
"coverage:merge": "rimraf tmp/coverage/{all,merge} && cp-flat \"tmp/coverage/*/json/**/*.json\" \"tmp/coverage/merge\" && nyc report -r lcov --report-dir tmp/coverage/all/lcov --temp-dir \"tmp/coverage/merge/\"",
|
|
44
|
-
"coverage:check": "pnpm run coverage:merge && nyc check-coverage --report-dir tmp/coverage/all/lcov --lines 50 --functions 50 --branches 50 --statements 50",
|
|
45
|
-
"test:mocha": "mocha ./src/**/*.test.*",
|
|
46
|
-
"test:mocha:coverage": "rimraf tmp/coverage/mocha && nyc --all mocha ./src/**/*.test.*",
|
|
47
|
-
"test:mocha:watch": "mocha --watch ./src/**/*.test.*",
|
|
48
|
-
"test:karma": "rimraf tmp/coverage/karma && karma start --single-run --log-level debug",
|
|
49
|
-
"test:mocha:ci": "rimraf tmp/coverage/mocha && nyc --all mocha ./{src,dist/lib}/**/*.test.*",
|
|
50
|
-
"coveralls": "pnpm run coverage:check && nyc report --reporter=text-lcov --temp-dir \"tmp/coverage/merge/\" | coveralls"
|
|
51
|
-
},
|
|
52
35
|
"devDependencies": {
|
|
53
36
|
"@babel/core": "7.18.5",
|
|
54
37
|
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
|
@@ -58,7 +41,7 @@
|
|
|
58
41
|
"@babel/runtime-corejs3": "7.18.3",
|
|
59
42
|
"@flemist/copy-glob-flat": "0.0.5",
|
|
60
43
|
"@flemist/karma-custom-launcher": "0.0.0",
|
|
61
|
-
"@flemist/test-utils": "
|
|
44
|
+
"@flemist/test-utils": "1.0.2",
|
|
62
45
|
"@rollup/plugin-alias": "3.1.9",
|
|
63
46
|
"@rollup/plugin-babel": "5.3.1",
|
|
64
47
|
"@rollup/plugin-commonjs": "=21.1.0",
|
|
@@ -75,7 +58,7 @@
|
|
|
75
58
|
"@zerollup/ts-transform-paths": "1.7.18",
|
|
76
59
|
"cpy-cli": "=3.1.1",
|
|
77
60
|
"eslint": "8.18.0",
|
|
78
|
-
"eslint-config-pro": "3.0.
|
|
61
|
+
"eslint-config-pro": "3.0.19",
|
|
79
62
|
"globby": "=11.1.0",
|
|
80
63
|
"karma": "6.4.0",
|
|
81
64
|
"karma-chrome-launcher": "3.1.1",
|
|
@@ -85,7 +68,7 @@
|
|
|
85
68
|
"karma-safari-launcher": "1.0.0",
|
|
86
69
|
"mocha": "9.2.2",
|
|
87
70
|
"nyc": "15.1.0",
|
|
88
|
-
"rdtsc": "3.0.
|
|
71
|
+
"rdtsc": "3.0.4",
|
|
89
72
|
"rimraf": "3.0.2",
|
|
90
73
|
"rollup": "2.75.7",
|
|
91
74
|
"rollup-plugin-delete": "2.0.0",
|
|
@@ -98,7 +81,25 @@
|
|
|
98
81
|
"typescript": "=4.7.4"
|
|
99
82
|
},
|
|
100
83
|
"dependencies": {
|
|
101
|
-
"@flemist/abort-controller-fast": "1.0.0",
|
|
84
|
+
"@flemist/abort-controller-fast": "^1.0.0",
|
|
85
|
+
"@flemist/async-utils": "^1.0.0",
|
|
86
|
+
"@flemist/time-limits": "^1.0.1",
|
|
102
87
|
"tslib": "^2.4.0"
|
|
88
|
+
},
|
|
89
|
+
"scripts": {
|
|
90
|
+
"audit": "pnpm audit --prod",
|
|
91
|
+
"lint": "eslint ./**/*.{js,cjs,mjs,ts,tsx}",
|
|
92
|
+
"lint:fix": "eslint --fix ./**/*.{js,cjs,mjs,ts,tsx}",
|
|
93
|
+
"lint:wizard": "eslint-nibble --cache --multi ./**/*.{js,cjs,mjs,ts,tsx}",
|
|
94
|
+
"build:js": "rimraf dist/lib && cpy \"**/assets/**\" \"**/*.{js,cjs,mjs}\" \"../dist/lib/\" --parents --cwd=src && rollup -c",
|
|
95
|
+
"build": "rimraf dist && pnpm run build:js",
|
|
96
|
+
"coverage:merge": "rimraf tmp/coverage/{all,merge} && cp-flat \"tmp/coverage/*/json/**/*.json\" \"tmp/coverage/merge\" && nyc report -r lcov --report-dir tmp/coverage/all/lcov --temp-dir \"tmp/coverage/merge/\"",
|
|
97
|
+
"coverage:check": "pnpm run coverage:merge && nyc check-coverage --report-dir tmp/coverage/all/lcov --lines 50 --functions 50 --branches 50 --statements 50",
|
|
98
|
+
"test:mocha": "mocha ./src/**/*.test.*",
|
|
99
|
+
"test:mocha:coverage": "rimraf tmp/coverage/mocha && nyc --all mocha ./src/**/*.test.*",
|
|
100
|
+
"test:mocha:watch": "mocha --watch ./src/**/*.test.*",
|
|
101
|
+
"test:karma": "rimraf tmp/coverage/karma && karma start --single-run --log-level debug",
|
|
102
|
+
"test:mocha:ci": "rimraf tmp/coverage/mocha && nyc --all mocha ./{src,dist/lib}/**/*.test.*",
|
|
103
|
+
"coveralls": "pnpm run coverage:check && nyc report --reporter=text-lcov --temp-dir \"tmp/coverage/merge/\" | coveralls"
|
|
103
104
|
}
|
|
104
|
-
}
|
|
105
|
+
}
|