@flemist/test-variants 1.0.6 → 2.0.0-alpha
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 +270 -228
- package/dist/lib/index.cjs +6 -2
- package/dist/lib/index.d.ts +5 -2
- package/dist/lib/index.mjs +6 -2
- package/dist/lib/test-variants/argsToString.cjs +17 -0
- package/dist/lib/test-variants/argsToString.d.ts +2 -0
- package/dist/lib/test-variants/argsToString.mjs +13 -0
- package/dist/lib/test-variants/createTestVariants.cjs +68 -189
- package/dist/lib/test-variants/createTestVariants.d.ts +8 -30
- package/dist/lib/test-variants/createTestVariants.mjs +68 -189
- package/dist/lib/test-variants/createTestVariants.perf.cjs +29 -20
- package/dist/lib/test-variants/createTestVariants.perf.mjs +29 -20
- package/dist/lib/test-variants/prime.cjs +65 -0
- package/dist/lib/test-variants/prime.d.ts +3 -0
- package/dist/lib/test-variants/prime.mjs +59 -0
- package/dist/lib/test-variants/prime.perf.cjs +30 -0
- package/dist/lib/test-variants/prime.perf.d.ts +1 -0
- package/dist/lib/test-variants/prime.perf.mjs +28 -0
- package/dist/lib/test-variants/testVariantsCreateTestRun.cjs +80 -0
- package/dist/lib/test-variants/testVariantsCreateTestRun.d.ts +22 -0
- package/dist/lib/test-variants/testVariantsCreateTestRun.mjs +76 -0
- package/dist/lib/test-variants/testVariantsIterable.cjs +67 -0
- package/dist/lib/test-variants/testVariantsIterable.d.ts +12 -0
- package/dist/lib/test-variants/testVariantsIterable.mjs +63 -0
- package/dist/lib/test-variants/testVariantsRun.cjs +187 -0
- package/dist/lib/test-variants/testVariantsRun.d.ts +31 -0
- package/dist/lib/test-variants/testVariantsRun.mjs +183 -0
- package/dist/lib/test-variants/types.cjs +2 -0
- package/dist/lib/test-variants/types.d.ts +1 -0
- package/dist/lib/test-variants/types.mjs +1 -0
- package/package.json +24 -23
package/dist/bundle/browser.js
CHANGED
|
@@ -1,219 +1,252 @@
|
|
|
1
1
|
!function(t){"use strict";var e=function(){
|
|
2
2
|
return e=Object.assign||function(t){
|
|
3
|
-
for(var e,n=1,r=arguments.length;n<r;n++)for(var
|
|
3
|
+
for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
|
|
4
4
|
;return t},e.apply(this,arguments)}
|
|
5
5
|
;function n(t,e,n,r){
|
|
6
|
-
return new(n||(n=Promise))(
|
|
7
|
-
function o(t){try{c(r.next(t))}catch(t){
|
|
8
|
-
function l(t){try{c(r.throw(t))}catch(t){
|
|
6
|
+
return new(n||(n=Promise))(function(i,s){
|
|
7
|
+
function o(t){try{c(r.next(t))}catch(t){s(t)}}
|
|
8
|
+
function l(t){try{c(r.throw(t))}catch(t){s(t)}}
|
|
9
9
|
function c(t){var e
|
|
10
|
-
;t.done?
|
|
11
|
-
t(e)}))
|
|
12
|
-
}
|
|
13
|
-
sent:function(){if(1&
|
|
14
|
-
trys:[],ops:[]};return
|
|
10
|
+
;t.done?i(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,i,s,o={label:0,
|
|
13
|
+
sent:function(){if(1&i[0])throw i[1];return i[1]},
|
|
14
|
+
trys:[],ops:[]};return s={next:l(0),throw:l(1),
|
|
15
15
|
return:l(2)
|
|
16
|
-
},"function"==typeof Symbol&&(
|
|
17
|
-
return this}),
|
|
18
|
-
return function(
|
|
16
|
+
},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){
|
|
17
|
+
return this}),s;function l(l){return function(c){
|
|
18
|
+
return function(l){
|
|
19
19
|
if(n)throw new TypeError("Generator is already executing.")
|
|
20
|
-
;for(;o;)try{
|
|
21
|
-
if(n=1,r&&(
|
|
22
|
-
0):r.next)&&!(
|
|
23
|
-
;switch(r=0,
|
|
24
|
-
case 1:
|
|
25
|
-
value:
|
|
26
|
-
;continue;case 7:
|
|
20
|
+
;for(;s&&(s=0,l[0]&&(o=0)),o;)try{
|
|
21
|
+
if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),
|
|
22
|
+
0):r.next)&&!(i=i.call(r,l[1])).done)return i
|
|
23
|
+
;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:
|
|
24
|
+
case 1:i=l;break;case 4:return o.label++,{
|
|
25
|
+
value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0]
|
|
26
|
+
;continue;case 7:l=o.ops.pop(),o.trys.pop()
|
|
27
27
|
;continue;default:
|
|
28
|
-
if(!(
|
|
28
|
+
if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){
|
|
29
29
|
o=0;continue}
|
|
30
|
-
if(3===
|
|
31
|
-
o.label=
|
|
32
|
-
o.label=
|
|
33
|
-
o.label=
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if(5&
|
|
37
|
-
value:
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
;return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
;if(
|
|
50
|
-
;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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{
|
|
30
|
+
if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){
|
|
31
|
+
o.label=l[1];break}if(6===l[0]&&o.label<i[1]){
|
|
32
|
+
o.label=i[1],i=l;break}if(i&&o.label<i[2]){
|
|
33
|
+
o.label=i[2],o.ops.push(l);break}
|
|
34
|
+
i[2]&&o.ops.pop(),o.trys.pop();continue}
|
|
35
|
+
l=e.call(t,o)}catch(t){l=[6,t],r=0}finally{n=i=0}
|
|
36
|
+
if(5&l[0])throw l[1];return{
|
|
37
|
+
value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}
|
|
38
|
+
function i(t){var n,r=t.argsTemplates
|
|
39
|
+
;return(n={})[Symbol.iterator]=function(){
|
|
40
|
+
var t=Object.keys(r),n=Object.values(r),i=t.length,s={}
|
|
41
|
+
;function o(t){var e=n[t]
|
|
42
|
+
;return"function"==typeof e&&(e=e(s)),e}
|
|
43
|
+
for(var l=[],c=[],u=0;u<i;u++)l[u]=-1,c[u]=[]
|
|
44
|
+
;return c[0]=o(0),{next:function(){
|
|
45
|
+
return function(){for(var e=i-1;e>=0;e--){
|
|
46
|
+
var n=l[e]+1;if(n<c[e].length){
|
|
47
|
+
var r=t[e],u=c[e][n]
|
|
48
|
+
;for(l[e]=n,s[r]=u,e++;e<i;e++){var a=o(e)
|
|
49
|
+
;if(0===a.length)break;l[e]=0,c[e]=a
|
|
50
|
+
;var h=t[e],f=a[0];s[h]=f}if(e>=i)return!0}}
|
|
51
|
+
return!1}()?{done:!1,value:e({},s)}:{done:!0,
|
|
52
|
+
value:null}}}},n}function s(t,e){return t<e}
|
|
53
|
+
class o{
|
|
63
54
|
constructor({objectPool:t,lessThanFunc:e}={}){
|
|
64
|
-
this._size=0,this._root=null,this.merge=
|
|
65
|
-
this.collapse=
|
|
55
|
+
this._size=0,this._root=null,this.merge=l,
|
|
56
|
+
this.collapse=c,this._objectPool=t,this._lessThanFunc=e||s
|
|
66
57
|
}clear(){this._root=null,this._size=0}get size(){
|
|
67
58
|
return this._size}add(t){
|
|
68
59
|
let e=null!=this._objectPool?this._objectPool.get():null
|
|
69
60
|
;return null==e?e={child:null,next:null,prev:null,
|
|
70
61
|
item:t
|
|
71
|
-
}:e.item=t,this._size++,this._root=
|
|
62
|
+
}:e.item=t,this._size++,this._root=l(this._root,e,this._lessThanFunc),e
|
|
72
63
|
}getMin(){const{_root:t}=this
|
|
73
64
|
;return null==t?void 0:t.item}getMinNode(){
|
|
74
65
|
return this._root}deleteMin(){const{_root:t}=this
|
|
75
66
|
;if(null==t)return;const e=t.item
|
|
76
67
|
;return this.delete(t),e}delete(t){var e
|
|
77
|
-
;if(t===this._root)this._root=
|
|
68
|
+
;if(t===this._root)this._root=c(t.child,this._lessThanFunc);else{
|
|
78
69
|
if(null==t.prev){
|
|
79
70
|
if(this._objectPool)throw new Error("The node is already deleted. Don't use the objectPool to prevent this error.")
|
|
80
71
|
;return}
|
|
81
72
|
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=
|
|
73
|
+
this._root=l(this._root,c(t.child,this._lessThanFunc),this._lessThanFunc)
|
|
83
74
|
}
|
|
84
75
|
t.child=null,t.prev=null,t.next=null,t.item=void 0,null===(e=this._objectPool)||void 0===e||e.release(t),
|
|
85
76
|
this._size--}decreaseKey(t){
|
|
86
77
|
t!==this._root&&(t.prev.child===t?t.prev.child=t.next:t.prev.next=t.next,
|
|
87
78
|
null!=t.next&&(t.next.prev=t.prev),
|
|
88
|
-
this._root=
|
|
79
|
+
this._root=l(this._root,t,this._lessThanFunc))}
|
|
89
80
|
get isEmpty(){return null==this._root}
|
|
90
81
|
[Symbol.iterator](){return this._iterate(!1)}
|
|
91
82
|
nodes(){return{
|
|
92
83
|
[Symbol.iterator]:()=>this._iterate(!0)}}
|
|
93
84
|
_iterate(t){const e=this._lessThanFunc
|
|
94
85
|
;return function*n(r){
|
|
95
|
-
r&&(t?yield r:yield r.item,r.child&&(null!=r.child.next&&(r.child=
|
|
86
|
+
r&&(t?yield r:yield r.item,r.child&&(null!=r.child.next&&(r.child=c(r.child,e),
|
|
96
87
|
r.child.prev=r),yield*n(r.child)))}(this._root)}}
|
|
97
|
-
function
|
|
88
|
+
function l(t,e,n){let r,i
|
|
98
89
|
;return null==t?e:null==e||t===e?t:(n(e.item,t.item)?(r=e,
|
|
99
|
-
|
|
100
|
-
null!=r.child&&(r.child.prev=
|
|
101
|
-
r.next=null,r.prev=null,r)}function
|
|
102
|
-
let n,r,s,
|
|
103
|
-
;for(
|
|
104
|
-
if(r=i
|
|
105
|
-
i
|
|
106
|
-
for(o=null;null!=n;)
|
|
107
|
-
;return o}function
|
|
108
|
-
then(e,n){n(t)}}}(e))}function
|
|
90
|
+
i=t):(r=t,i=e),i.next=r.child,
|
|
91
|
+
null!=r.child&&(r.child.prev=i),i.prev=r,r.child=i,
|
|
92
|
+
r.next=null,r.prev=null,r)}function c(t,e){
|
|
93
|
+
let n,r,i,s,o;if(null==t)return null
|
|
94
|
+
;for(s=t,n=null;null!=s;){
|
|
95
|
+
if(r=s,i=r.next,null==i){r.prev=n,n=r;break}
|
|
96
|
+
s=i.next,o=l(r,i,e),o.prev=n,n=o}
|
|
97
|
+
for(o=null;null!=n;)s=n.prev,o=l(o,n,e),n=s
|
|
98
|
+
;return o}function u(t,e){t(function(t){return{
|
|
99
|
+
then(e,n){n(t)}}}(e))}function a(t){
|
|
109
100
|
return null!=t&&"object"==typeof t&&"function"==typeof t.then
|
|
110
|
-
}let
|
|
111
|
-
|
|
112
|
-
return n(this,void 0,void 0,
|
|
113
|
-
for(;
|
|
114
|
-
;
|
|
115
|
-
console.error("Unhandled promise rejection",t)}})
|
|
116
|
-
|
|
101
|
+
}let h,f=[];function d(t){
|
|
102
|
+
f.push(t),h||(h=function(){
|
|
103
|
+
return n(this,void 0,void 0,function*(){
|
|
104
|
+
for(;f.length>0;){yield 0;const t=f
|
|
105
|
+
;f=[],t.forEach(t=>{try{t()}catch(t){
|
|
106
|
+
console.error("Unhandled promise rejection",t)}})}
|
|
107
|
+
h=null})}())}function v(t,e,n){d(()=>{try{
|
|
117
108
|
const r=e?e(t):t;n._resolve(r)}catch(t){
|
|
118
|
-
n._reject(t)}})
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
this.status="pending",this.value=void 0,
|
|
123
|
-
this.
|
|
124
|
-
;
|
|
125
|
-
|
|
126
|
-
},this.
|
|
127
|
-
},this.
|
|
128
|
-
},this._rejectAsync=function(t){s.call(i,t)
|
|
109
|
+
n._reject(t)}})}function _(t,e,n){d(()=>{if(e)try{
|
|
110
|
+
const r=e(t);n._resolve(r)}catch(t){n._reject(t)
|
|
111
|
+
}else n._reject(t)})}const b=function(){};class y{
|
|
112
|
+
constructor(t){
|
|
113
|
+
this.status="pending",this.value=void 0,this.reason=void 0,this._handlers=null
|
|
114
|
+
;const e=this._resolve,n=this._reject,r=this._resolveAsync,i=this._rejectAsync,s=this
|
|
115
|
+
;this._resolve=function(t){e.call(s,t)
|
|
116
|
+
},this._reject=function(t){n.call(s,t)
|
|
117
|
+
},this._resolveAsync=function(t){r.call(s,t)
|
|
118
|
+
},this._rejectAsync=function(t){i.call(s,t)
|
|
129
119
|
},t(this._resolve,this._reject)}_resolve(t){
|
|
130
120
|
"pending"===this.status&&(this.status="fulfilled",
|
|
131
121
|
this._resolveAsync(t))}_resolveAsync(t){
|
|
132
|
-
|
|
122
|
+
a(t)?t.then(this._resolveAsync,this._rejectAsync):this._resolveSync(t)
|
|
133
123
|
}_resolveSync(t){const e=this._handlers
|
|
134
124
|
;if(this.value=t,null!=e){this._handlers=null
|
|
135
|
-
;for(let n=0,r=e.length;n<r;n++){const[r,,
|
|
136
|
-
;
|
|
125
|
+
;for(let n=0,r=e.length;n<r;n++){const[r,,i]=e[n]
|
|
126
|
+
;v(t,r,i)}}}_reject(t){
|
|
137
127
|
"pending"===this.status&&this._rejectAsync(t)}
|
|
138
128
|
_rejectAsync(t){
|
|
139
|
-
this.status="rejected",
|
|
129
|
+
this.status="rejected",a(t)?t.then(this._rejectAsync,this._rejectAsync):this._rejectSync(t)
|
|
140
130
|
}_rejectSync(t){const e=this._handlers
|
|
141
131
|
;if(this.reason=t,null!=e){this._handlers=null
|
|
142
|
-
;for(let n=0,r=e.length;n<r;n++){const[,r,
|
|
143
|
-
;
|
|
132
|
+
;for(let n=0,r=e.length;n<r;n++){const[,r,i]=e[n]
|
|
133
|
+
;_(t,r,i)}}}then(t,e){const n=new y(b)
|
|
144
134
|
;return"pending"===this.status?(null==this._handlers&&(this._handlers=[]),
|
|
145
|
-
this._handlers.push([t,e,n])):"fulfilled"===this.status?
|
|
135
|
+
this._handlers.push([t,e,n])):"fulfilled"===this.status?v(this.value,t,n):_(this.reason,e,n),
|
|
146
136
|
n}catch(t){return this.then(void 0,t)}finally(t){
|
|
147
137
|
const e=t&&function(e){const n=t()
|
|
148
|
-
;return
|
|
138
|
+
;return a(n)?n.then(()=>e):y.resolve(e)
|
|
149
139
|
},n=t&&function(e){const n=t()
|
|
150
|
-
;return
|
|
151
|
-
|
|
152
|
-
const e=new
|
|
153
|
-
static reject(t){const e=new
|
|
140
|
+
;return a(n)?n.then(()=>y.reject(e)):y.reject(e)}
|
|
141
|
+
;return this.then(e,n)}static resolve(t){
|
|
142
|
+
const e=new y(b);return e._resolve(t),e}
|
|
143
|
+
static reject(t){const e=new y(b)
|
|
154
144
|
;return e._reject(t),e}get[Symbol.toStringTag](){
|
|
155
145
|
return"Promise"}static get[Symbol.species](){
|
|
156
|
-
return
|
|
157
|
-
let n,r;e||(e=Promise);const
|
|
158
|
-
n=t,r=e})
|
|
159
|
-
;return t.forEach((
|
|
160
|
-
o[e]=t,0
|
|
161
|
-
})
|
|
146
|
+
return y}static all(t){return function(t,e){
|
|
147
|
+
let n,r;e||(e=Promise);const i=new e((t,e)=>{
|
|
148
|
+
n=t,r=e});let s=t.length;const o=[]
|
|
149
|
+
;return t.forEach((t,e)=>{a(t)?t.then(t=>{
|
|
150
|
+
o[e]=t,0===--s&&n(o)},r):(o[e]=t,0===--s&&n(o))
|
|
151
|
+
}),i}(t,y)}static allSettled(t){
|
|
162
152
|
return function(t,e){let n;e||(e=Promise)
|
|
163
|
-
;const r=new e((
|
|
164
|
-
;const
|
|
165
|
-
|
|
166
|
-
},0
|
|
167
|
-
reason:t},0
|
|
168
|
-
status:"fulfilled",value:t},0
|
|
169
|
-
}(t,
|
|
170
|
-
;e||(e=Promise);const
|
|
171
|
-
;let
|
|
172
|
-
;return t.forEach((
|
|
173
|
-
o[e]=t,0
|
|
174
|
-
})
|
|
175
|
-
let n,r;e||(e=Promise);const
|
|
176
|
-
n=t,r=e})
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
if(this._status="pending",t&&t.aborted)this.promise=
|
|
180
|
-
this.resolve=
|
|
181
|
-
;if(this.promise=new Promise(
|
|
182
|
-
e=t,n=function(e){
|
|
183
|
-
const r=t.subscribe(
|
|
153
|
+
;const r=new e((t,e)=>{n=t});let i=t.length
|
|
154
|
+
;const s=[];return t.forEach((t,e)=>{
|
|
155
|
+
a(t)?t.then(t=>{s[e]={status:"fulfilled",value:t
|
|
156
|
+
},0===--i&&n(s)},t=>{s[e]={status:"rejected",
|
|
157
|
+
reason:t},0===--i&&n(s)}):(s[e]={
|
|
158
|
+
status:"fulfilled",value:t},0===--i&&n(s))}),r
|
|
159
|
+
}(t,y)}static any(t){return function(t,e){let n,r
|
|
160
|
+
;e||(e=Promise);const i=new e((t,e)=>{n=t,r=e})
|
|
161
|
+
;let s=t.length;const o=[]
|
|
162
|
+
;return t.forEach((t,e)=>{a(t)?t.then(n,t=>{
|
|
163
|
+
o[e]=t,0===--s&&r(new AggregateError(o))}):n(t)
|
|
164
|
+
}),i}(t,y)}static race(t){return function(t,e){
|
|
165
|
+
let n,r;e||(e=Promise);const i=new e((t,e)=>{
|
|
166
|
+
n=t,r=e});return t.forEach(t=>{
|
|
167
|
+
a(t)?t.then(n,r):n(t)}),i}(t,y)}}
|
|
168
|
+
const p=function(){};class w{constructor(t){
|
|
169
|
+
if(this._status="pending",t&&t.aborted)this.promise=y.reject(t.reason),
|
|
170
|
+
this.resolve=p,this.reject=p;else{let e,n
|
|
171
|
+
;if(this.promise=new Promise(function(t){
|
|
172
|
+
e=t,n=function(e){u(t,e)}}),t){
|
|
173
|
+
const r=t.subscribe(function(t){n(t)})
|
|
184
174
|
;this.resolve=function(t){r(),e(t)
|
|
185
175
|
},this.reject=function(t){r(),n(t)}
|
|
186
176
|
}else this.resolve=e,this.reject=n}
|
|
187
|
-
this.promise.then((
|
|
188
|
-
}
|
|
189
|
-
return this._status}}class
|
|
177
|
+
this.promise.then(()=>{this._status="resolved"
|
|
178
|
+
},()=>{this._status="rejected"})}get state(){
|
|
179
|
+
return this._status}}class m extends Error{
|
|
180
|
+
constructor(t,e){
|
|
181
|
+
super(t),Object.setPrototypeOf(this,m.prototype),this.reason=e,
|
|
182
|
+
this.name="AbortError",this._internal=!1}}
|
|
183
|
+
const g=()=>{};class j{constructor(){
|
|
184
|
+
this.aborted=!1,this.reason=void 0,this._callbacks=void 0
|
|
185
|
+
}subscribe(t){var e
|
|
186
|
+
;if(null===(e=this._callbacks)||void 0===e?void 0:e.has(t))throw new Error("Already subscribed: "+t)
|
|
187
|
+
;return this.aborted?(t.call(this,this.reason),
|
|
188
|
+
g):(this._callbacks||(this._callbacks=new Set),
|
|
189
|
+
this._callbacks.add(t),()=>{var e
|
|
190
|
+
;null===(e=this._callbacks)||void 0===e||e.delete(t)
|
|
191
|
+
})}abort(t){var e
|
|
192
|
+
;this.aborted=!0,this.reason=t,null===(e=this._callbacks)||void 0===e||e.forEach(t=>{
|
|
193
|
+
t.call(this,this.reason)}),this._callbacks=void 0}
|
|
194
|
+
throwIfAborted(){if(this.aborted)throw this.reason
|
|
195
|
+
}}class x{constructor(){this.signal=new j}
|
|
196
|
+
abort(t){
|
|
197
|
+
this.signal.aborted||(void 0===t&&((t=new m("Aborted with no reason",t))._internal=!0),
|
|
198
|
+
this.signal.abort(t))}}function S(t,e){
|
|
199
|
+
var i=0,s=null;function o(t,o,l){
|
|
200
|
+
return n(this,void 0,void 0,function(){var n
|
|
201
|
+
;return r(this,function(r){switch(r.label){case 0:
|
|
202
|
+
return s={error:t,args:o,index:l
|
|
203
|
+
},console.error("[test-variants] error variant: ".concat(l,"\n").concat(function(t){
|
|
204
|
+
return JSON.stringify(t,function(t,e){
|
|
205
|
+
return e&&"object"==typeof e&&!Array.isArray(e)&&e.constructor!==Object?e+"":e
|
|
206
|
+
},2)
|
|
207
|
+
}(o))),console.error(t),n=Date.now(),Date.now()-n>50&&i<5?(console.log("[test-variants] DEBUG ITERATION: "+i),
|
|
208
|
+
i++,[2]):e.onError?[4,e.onError(s)]:[3,2];case 1:
|
|
209
|
+
r.sent(),r.label=2;case 2:throw s.error}})})}
|
|
210
|
+
return function(e,n,r){try{var i=t(e,r)
|
|
211
|
+
;if(a(i))return i.then(function(t){
|
|
212
|
+
return"number"==typeof t?{iterationsAsync:t,
|
|
213
|
+
iterationsSync:0}:null!==t&&"object"==typeof t?t:{
|
|
214
|
+
iterationsAsync:1,iterationsSync:0}},function(t){
|
|
215
|
+
return o(t,e,n)});return"number"==typeof i?{
|
|
216
|
+
iterationsAsync:0,iterationsSync:i
|
|
217
|
+
}:null!==i&&"object"==typeof i?i:{
|
|
218
|
+
iterationsAsync:0,iterationsSync:1}}catch(t){
|
|
219
|
+
return o(t,e,n)}}}class P{constructor(t,e){
|
|
190
220
|
this._branch=null,this.order=t,this.parent=e}
|
|
191
221
|
get branch(){if(!this._branch){
|
|
192
222
|
const t=[this.order];let e=this.parent
|
|
193
223
|
;for(;null!=e;)t.push(e.order),e=e.parent
|
|
194
224
|
;this._branch=t}return this._branch}}
|
|
195
|
-
function
|
|
196
|
-
|
|
225
|
+
const z=function(t){return t};function A(t,e){
|
|
226
|
+
return function(t,e){
|
|
227
|
+
const n=t&&t.branch,r=e&&e.branch,i=n?n.length:0,s=r?r.length:0,o=i>s?i:s
|
|
197
228
|
;for(let t=0;t<o;t++){
|
|
198
|
-
const e=t>=
|
|
229
|
+
const e=t>=i?0:n[i-1-t],o=t>=s?0:r[s-1-t]
|
|
199
230
|
;if(e!==o)return e>o?1:-1}return 0
|
|
200
|
-
}(t.priority,e.priority)<0}let k=1;class
|
|
201
|
-
constructor(){this._queue=new
|
|
231
|
+
}(t.priority,e.priority)<0}let k=1;class E{
|
|
232
|
+
constructor(){this._queue=new o({lessThanFunc:A})}
|
|
202
233
|
run(t,e,n){return this._run(!1,t,e,n)}
|
|
203
234
|
runTask(t,e,n){return this._run(!0,t,e,n)}
|
|
204
|
-
_run(t,e,n,r){const
|
|
235
|
+
_run(t,e,n,r){const i=new w(r),s={
|
|
205
236
|
priority:(o=k++,l=n,null==o?null==l?null:l:new P(o,l)),
|
|
206
|
-
func:e,abortSignal:r,resolve:
|
|
207
|
-
reject:
|
|
208
|
-
;if(this._queue.add(
|
|
209
|
-
result:
|
|
210
|
-
|
|
237
|
+
func:e,abortSignal:r,resolve:i.resolve,
|
|
238
|
+
reject:i.reject,readyToRun:!t};var o,l
|
|
239
|
+
;if(this._queue.add(s),t){const t=this;return{
|
|
240
|
+
result:i.promise,setReadyToRun(e){
|
|
241
|
+
s.readyToRun=e,e&&!t._inProcess&&(t._inProcess=!0,
|
|
211
242
|
t._process())}}}
|
|
212
|
-
return this._inProcess||(this._inProcess=!0,this._process()),
|
|
243
|
+
return this._inProcess||(this._inProcess=!0,this._process()),i.promise
|
|
213
244
|
}_process(){
|
|
214
|
-
return n(this,void 0,void 0,
|
|
215
|
-
const t=this._queue
|
|
216
|
-
|
|
245
|
+
return n(this,void 0,void 0,function*(){
|
|
246
|
+
const t=this._queue
|
|
247
|
+
;for(yield Promise.resolve().then(z);;){
|
|
248
|
+
if(yield 0,t.isEmpty){this._inProcess=!1;break}
|
|
249
|
+
let e=t.getMin()
|
|
217
250
|
;if(e.readyToRun)t.deleteMin();else{let n
|
|
218
251
|
;for(const e of t.nodes())if(e.item.readyToRun){
|
|
219
252
|
n=e;break}if(!n){this._inProcess=!1;break}
|
|
@@ -221,13 +254,13 @@ e=n.item,t.delete(n)}
|
|
|
221
254
|
if(e.abortSignal&&e.abortSignal.aborted)e.reject(e.abortSignal.reason);else try{
|
|
222
255
|
let t=e.func&&e.func(e.abortSignal)
|
|
223
256
|
;t&&"function"==typeof t.then&&(t=yield t),e.resolve(t)
|
|
224
|
-
}catch(t){e.reject(t)}}})
|
|
225
|
-
const t=new
|
|
226
|
-
return t.run(void 0,e,n)}}();class
|
|
257
|
+
}catch(t){e.reject(t)}}})}}const T=function(){
|
|
258
|
+
const t=new E;return function(e,n){
|
|
259
|
+
return t.run(void 0,e,n)}}();class O{
|
|
227
260
|
constructor(t){
|
|
228
|
-
if(this._maxSize=0,this._size=0,this._tickPromise=new
|
|
261
|
+
if(this._maxSize=0,this._size=0,this._tickPromise=new w,!t)throw new Error("maxSize should be > 0")
|
|
229
262
|
;this._maxSize=t,
|
|
230
|
-
this._size=t,this._priorityQueue=new
|
|
263
|
+
this._size=t,this._priorityQueue=new E}
|
|
231
264
|
get maxSize(){return this._maxSize}get size(){
|
|
232
265
|
return this._size}get holdAvailable(){
|
|
233
266
|
return this._size}hold(t){const e=this._size
|
|
@@ -240,85 +273,94 @@ if(!e)throw new Error(`count (${t} > maxReleaseCount (${r}))`)
|
|
|
240
273
|
const t=this._tickPromise
|
|
241
274
|
;this._tickPromise=null,t.resolve()}return t}
|
|
242
275
|
tick(t){
|
|
243
|
-
if(!(this._size>=this._maxSize))return this._tickPromise||(this._tickPromise=new
|
|
244
|
-
function(t,e){return t?new Promise(
|
|
245
|
-
if(t&&t.aborted)return void
|
|
246
|
-
;function
|
|
247
|
-
e.then(
|
|
248
|
-
})
|
|
249
|
-
}(t,this._tickPromise.promise)}holdWait(t,e,r,
|
|
276
|
+
if(!(this._size>=this._maxSize))return this._tickPromise||(this._tickPromise=new w),
|
|
277
|
+
function(t,e){return t?new Promise(function(n){
|
|
278
|
+
if(t&&t.aborted)return void u(n,t.reason);let r,i
|
|
279
|
+
;function s(t){i||(i=!0,r&&r(),u(n,t))}
|
|
280
|
+
e.then(function(t){r&&r(),n(t)
|
|
281
|
+
}).catch(s),t&&(r=t.subscribe(s))}):e
|
|
282
|
+
}(t,this._tickPromise.promise)}holdWait(t,e,r,i){
|
|
250
283
|
if(t>this.maxSize)throw new Error(`holdCount (${t} > maxSize (${this.maxSize}))`)
|
|
251
|
-
;return
|
|
252
|
-
this._priorityQueue.run(
|
|
253
|
-
for(;t>this._size;)yield this.tick(r),yield
|
|
284
|
+
;return i||(i=T),
|
|
285
|
+
this._priorityQueue.run(r=>n(this,void 0,void 0,function*(){
|
|
286
|
+
for(;t>this._size;)yield this.tick(r),yield i(e,r)
|
|
254
287
|
;if(!this.hold(t))throw new Error("Unexpected behavior")
|
|
255
|
-
})
|
|
256
|
-
|
|
257
|
-
var
|
|
288
|
+
}),e,r)}}function F(t){
|
|
289
|
+
if(null==t||t<=0)throw new Error("Iterations = ".concat(t))
|
|
290
|
+
;t--;var e=new Promise(function(e){
|
|
291
|
+
setTimeout(function(){e(t)},1)})
|
|
292
|
+
;return t<=0?e:e.then(F)}function I(t,i,s){
|
|
293
|
+
var o,l,c,u,h,f
|
|
294
|
+
;return void 0===s&&(s={}),n(this,void 0,void 0,function(){
|
|
295
|
+
function d(){
|
|
296
|
+
return n(this,void 0,void 0,function(){
|
|
297
|
+
var s,o=this;return r(this,function(l){
|
|
298
|
+
switch(l.label){case 0:s=function(){
|
|
299
|
+
var i,s,l,c,u,h,f;return r(this,function(d){
|
|
300
|
+
switch(d.label){case 0:return i=z,s=e(e({},A),{
|
|
301
|
+
seed:null==S?void 0:S.value
|
|
302
|
+
}),l=(y||b)&&Date.now(),y&&l-D>=y&&(console.log(M),D=l),
|
|
303
|
+
v&&M-$>=v||_&&C-q>=_||b&&l-G>=b?($=M,
|
|
304
|
+
q=C,G=l,[4,F(1)]):[3,2];case 1:d.sent(),d.label=2
|
|
305
|
+
;case 2:
|
|
306
|
+
if(null==w?void 0:w.aborted)return[2,"continue"]
|
|
307
|
+
;if(N&&!T.aborted)return[3,8];d.label=3;case 3:
|
|
308
|
+
return d.trys.push([3,6,,7]),a(c=t(s,i,T))?[4,c]:[3,5]
|
|
309
|
+
;case 4:c=d.sent(),d.label=5;case 5:
|
|
310
|
+
return c?(u=c.iterationsAsync,h=c.iterationsSync,
|
|
311
|
+
C+=u,M+=h+u,[3,7]):(R=!0,E.abort(),[2,"continue"])
|
|
312
|
+
;case 6:if(f=d.sent(),!m)throw f;return P={
|
|
313
|
+
error:f,args:s,index:i},R=!1,[3,7];case 7:
|
|
314
|
+
return[3,11];case 8:
|
|
315
|
+
return N.hold(1)?[3,10]:[4,N.holdWait(1)];case 9:
|
|
316
|
+
d.sent(),d.label=10;case 10:
|
|
317
|
+
n(o,void 0,void 0,function(){var e,n,o,l
|
|
318
|
+
;return r(this,function(r){switch(r.label){case 0:
|
|
319
|
+
return r.trys.push([0,3,4,5]),
|
|
320
|
+
(null==T?void 0:T.aborted)?[2]:a(e=t(s,i,T))?[4,e]:[3,2]
|
|
321
|
+
;case 1:e=r.sent(),r.label=2;case 2:
|
|
322
|
+
return e?(n=e.iterationsAsync,o=e.iterationsSync,
|
|
323
|
+
C+=n,M+=o+n,[3,5]):(R=!0,E.abort(),[2]);case 3:
|
|
324
|
+
if(l=r.sent(),!m)throw l;return P={error:l,args:s,
|
|
325
|
+
index:i},R=!1,[3,5];case 4:return N.release(1),[7]
|
|
326
|
+
;case 5:return[2]}})}),d.label=11;case 11:
|
|
327
|
+
return[2]}})},l.label=1;case 1:
|
|
328
|
+
return(null==w?void 0:w.aborted)||!R&&!function(){
|
|
329
|
+
for(;;){if(z++,S&&S.done)return!1
|
|
330
|
+
;if(null==P||z<P.index){var t=k.next()
|
|
331
|
+
;if(!t.done)return A=t.value,!0}if(!j)return!1
|
|
332
|
+
;if((S=j.next()).done)return!1
|
|
333
|
+
;z=-1,k=i[Symbol.iterator]()}}()?[3,3]:[5,s()]
|
|
334
|
+
;case 2:return l.sent(),[3,1];case 3:
|
|
335
|
+
return N?[4,N.holdWait(g)]:[3,5];case 4:
|
|
336
|
+
l.sent(),N.release(g),l.label=5;case 5:
|
|
337
|
+
if(null==I?void 0:I.aborted)throw I.reason
|
|
338
|
+
;return p&&console.log("[test-variants] variants: ".concat(z,", iterations: ").concat(M,", async: ").concat(C)),
|
|
339
|
+
[4,F(1)];case 6:return l.sent(),[2,M]}})})}
|
|
340
|
+
var v,_,b,y,p,w,m,g,j,S,P,z,A,k,E,T,I,R,M,C,D,G,$,q,N
|
|
341
|
+
;return r(this,function(t){switch(t.label){case 0:
|
|
342
|
+
return v=null!==(o=s.GC_Iterations)&&void 0!==o?o:1e6,
|
|
343
|
+
_=null!==(l=s.GC_IterationsAsync)&&void 0!==l?l:1e4,
|
|
344
|
+
b=null!==(c=s.GC_Interval)&&void 0!==c?c:1e3,
|
|
345
|
+
y=null!==(u=s.logInterval)&&void 0!==u?u:5e3,
|
|
346
|
+
p=null===(h=s.logCompleted)||void 0===h||h,
|
|
347
|
+
w=s.abortSignal,m=s.findBestError,g=!0===s.parallel?Math.pow(2,31):!s.parallel||s.parallel<=0?1:s.parallel,
|
|
348
|
+
j=null!==(f=null==m?void 0:m.seeds[Symbol.iterator]())&&void 0!==f?f:null,
|
|
349
|
+
S=null==j?void 0:j.next(),
|
|
350
|
+
P=null,z=-1,A={},k=i[Symbol.iterator](),E=new x,T=function(...t){
|
|
258
351
|
let e,n;function r(t){e.abort(t)}
|
|
259
|
-
for(let
|
|
260
|
-
if(
|
|
261
|
-
n?(e||(e=new
|
|
262
|
-
}}return e?e.signal:n||(new
|
|
263
|
-
}(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
return
|
|
270
|
-
|
|
271
|
-
|
|
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){
|
|
281
|
-
return n(this,void 0,void 0,(function(){var n,o,l
|
|
282
|
-
;return r(this,(function(r){switch(r.label){
|
|
283
|
-
case 0:return r.trys.push([0,3,,5]),function(t){
|
|
284
|
-
return"object"==typeof t&&t&&"function"==typeof t.then
|
|
285
|
-
}(n=t(s,i))?[4,n]:[3,2];case 1:
|
|
286
|
-
return o=r.sent(),D+=l="number"==typeof o?o:1,C+=l,
|
|
287
|
-
[2];case 2:return C+="number"==typeof n?n:1,[3,5]
|
|
288
|
-
;case 3:return[4,N(r.sent(),e,s)];case 4:
|
|
289
|
-
return r.sent(),[3,5];case 5:return[2]}}))}))}
|
|
290
|
-
function H(){
|
|
291
|
-
return n(this,void 0,void 0,(function(){
|
|
292
|
-
var t,i=this;return r(this,(function(o){
|
|
293
|
-
switch(o.label){case 0:t=function(){var t,o,l
|
|
294
|
-
;return r(this,(function(c){switch(c.label){
|
|
295
|
-
case 0:
|
|
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:
|
|
299
|
-
return c.sent(),[2,"continue"];case 2:
|
|
300
|
-
return(null==j?void 0:j.aborted)?[2,"continue"]:K&&!S.aborted?[3,4]:[4,V(t,o,j)]
|
|
301
|
-
;case 3:return c.sent(),[3,7];case 4:
|
|
302
|
-
return K.hold(1)?[3,6]:[4,K.holdWait(1)];case 5:
|
|
303
|
-
c.sent(),c.label=6;case 6:
|
|
304
|
-
n(i,void 0,void 0,(function(){
|
|
305
|
-
return r(this,(function(e){switch(e.label){case 0:
|
|
306
|
-
return e.trys.push([0,,2,3]),(null==S?void 0:S.aborted)?[2]:[4,V(t,o,S)]
|
|
307
|
-
;case 1:return e.sent(),[3,3];case 2:
|
|
308
|
-
return K.release(1),[7];case 3:return[2]}}))
|
|
309
|
-
})),c.label=7;case 7:return[2]}}))},o.label=1
|
|
310
|
-
;case 1:
|
|
311
|
-
return(null==j?void 0:j.aborted)||!G&&!function(){
|
|
312
|
-
for(var t=T-1;t>=0;t--){var e=I[t]+1
|
|
313
|
-
;if(e<R[t].length){
|
|
314
|
-
for(I[t]=e,O[z[t]]=R[t][e],t++;t<T;t++){var n=F(t)
|
|
315
|
-
;if(0===n.length)break;I[t]=0,R[t]=n,O[z[t]]=n[0]}
|
|
316
|
-
if(t>=T)return!0}}return!1}()?[3,3]:[5,t()]
|
|
317
|
-
;case 2:return o.sent(),[3,1];case 3:
|
|
318
|
-
return K?[4,K.holdWait(J)]:[3,5];case 4:
|
|
319
|
-
o.sent(),K.release(J),o.label=5;case 5:
|
|
320
|
-
if(null==k?void 0:k.aborted)throw k.reason
|
|
321
|
-
;return y&&console.log("variants: "+C),[4,s(1)]
|
|
322
|
-
;case 6:return o.sent(),[2,C]}}))}))}return H()}}
|
|
352
|
+
for(let i=0;i<t.length;i++){const s=t[i];if(s){
|
|
353
|
+
if(s.aborted)return s
|
|
354
|
+
;n?(e||(e=new x,n.subscribe(r)),s.subscribe(r)):n=s
|
|
355
|
+
}}return e?e.signal:n||(new x).signal
|
|
356
|
+
}(w,E.signal),I=T,R=!1,M=0,C=0,D=Date.now(),
|
|
357
|
+
G=D,$=M,q=C,N=g<=1?null:new O(g),[4,d()];case 1:
|
|
358
|
+
return[2,{iterations:t.sent(),bestError:P}]}})})}
|
|
359
|
+
t.createTestVariants=function(t){
|
|
360
|
+
return function(e){return function(s){
|
|
361
|
+
return n(this,void 0,void 0,function(){var n,o
|
|
362
|
+
;return r(this,function(r){return n=S(t,{
|
|
363
|
+
onError:null==s?void 0:s.onError}),o=i({
|
|
364
|
+
argsTemplates:e}),[2,I(n,o,s)]})})}}
|
|
323
365
|
},Object.defineProperty(t,"__esModule",{value:!0})
|
|
324
366
|
}({});
|
package/dist/lib/index.cjs
CHANGED
|
@@ -4,10 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var testVariants_createTestVariants = require('./test-variants/createTestVariants.cjs');
|
|
6
6
|
require('tslib');
|
|
7
|
-
require('./
|
|
7
|
+
require('./test-variants/testVariantsIterable.cjs');
|
|
8
|
+
require('./test-variants/testVariantsCreateTestRun.cjs');
|
|
9
|
+
require('@flemist/async-utils');
|
|
10
|
+
require('./test-variants/argsToString.cjs');
|
|
11
|
+
require('./test-variants/testVariantsRun.cjs');
|
|
8
12
|
require('@flemist/abort-controller-fast');
|
|
9
13
|
require('@flemist/time-limits');
|
|
10
|
-
require('
|
|
14
|
+
require('./garbage-collect/garbageCollect.cjs');
|
|
11
15
|
|
|
12
16
|
|
|
13
17
|
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
1
|
+
export { type Obj, } from "./test-variants/types";
|
|
2
|
+
export { type TestVariantsTemplate, type TestVariantsTemplates, type TestVariantsTemplatesExt, } from "./test-variants/testVariantsIterable";
|
|
3
|
+
export { type ErrorEvent, type OnErrorCallback, type TestVariantsTest, type TestVariantsTestResult, type TestVariantsCreateTestRunOptions, type TestVariantsTestRun, type TestVariantsTestRunResult, } from "./test-variants/testVariantsCreateTestRun";
|
|
4
|
+
export { type TestVariantsFindBestErrorOptions, type TestVariantsRunOptions, type TestVariantsBestError, type TestVariantsRunResult, } from "./test-variants/testVariantsRun";
|
|
5
|
+
export { type TestVariantsSetArgs, type TestVariantsCall, createTestVariants, } from './test-variants/createTestVariants';
|
package/dist/lib/index.mjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export { createTestVariants } from './test-variants/createTestVariants.mjs';
|
|
2
2
|
import 'tslib';
|
|
3
|
-
import './
|
|
3
|
+
import './test-variants/testVariantsIterable.mjs';
|
|
4
|
+
import './test-variants/testVariantsCreateTestRun.mjs';
|
|
5
|
+
import '@flemist/async-utils';
|
|
6
|
+
import './test-variants/argsToString.mjs';
|
|
7
|
+
import './test-variants/testVariantsRun.mjs';
|
|
4
8
|
import '@flemist/abort-controller-fast';
|
|
5
9
|
import '@flemist/time-limits';
|
|
6
|
-
import '
|
|
10
|
+
import './garbage-collect/garbageCollect.mjs';
|