@flemist/test-variants 5.0.3 → 5.0.5
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/README.md +4 -0
- package/build/browser/index.cjs +1 -1
- package/build/browser/index.mjs +1 -1
- package/build/common/index.cjs +1 -1
- package/build/common/index.mjs +1 -1
- package/build/common/test-variants/run/types.d.ts +2 -0
- package/build/common/test-variants/types.d.ts +2 -0
- package/build/{createTestVariants-BaW2oQ-k.mjs → createTestVariants-BXmWQaT8.mjs} +366 -373
- package/build/createTestVariants-BYmqvvhv.js +4 -0
- package/build/node/index.cjs +1 -1
- package/build/node/index.mjs +1 -1
- package/package.json +35 -32
- package/build/createTestVariants-LuHR6HJQ.js +0 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { timeControllerDefault as Q } from "@flemist/time-controller";
|
|
2
|
-
import { formatAny as z, deepCloneJsonLike as
|
|
3
|
-
import { isPromiseLike as M, waitMicrotasks as
|
|
4
|
-
import { AbortError as
|
|
5
|
-
import { poolWait as
|
|
2
|
+
import { formatAny as z, deepCloneJsonLike as He } from "@flemist/simple-utils";
|
|
3
|
+
import { isPromiseLike as M, waitMicrotasks as Je, combineAbortSignals as ie } from "@flemist/async-utils";
|
|
4
|
+
import { AbortError as Xe, AbortControllerFast as se } from "@flemist/abort-controller-fast";
|
|
5
|
+
import { poolWait as ae, Pool as Ze } from "@flemist/time-limits";
|
|
6
6
|
function Y() {
|
|
7
7
|
if (typeof process < "u" && process.memoryUsage)
|
|
8
8
|
try {
|
|
@@ -19,21 +19,21 @@ function Y() {
|
|
|
19
19
|
}
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
function
|
|
22
|
+
const Ke = 1e3, q = [];
|
|
23
|
+
function Qe(e) {
|
|
24
24
|
return z(e, { pretty: !0, maxDepth: 5, maxItems: 50 });
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const n = e.map((t) => typeof t == "string" ? t :
|
|
28
|
-
|
|
26
|
+
function Ye(...e) {
|
|
27
|
+
const n = e.map((t) => typeof t == "string" ? t : Qe(t)).join(" ");
|
|
28
|
+
q.push(n), q.length > Ke && q.shift(), console.log(n);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function et() {
|
|
31
|
+
return q.join(`
|
|
32
32
|
`);
|
|
33
33
|
}
|
|
34
|
-
globalThis.__getStressTestLogLast =
|
|
34
|
+
globalThis.__getStressTestLogLast = et;
|
|
35
35
|
const me = (e, n) => {
|
|
36
|
-
|
|
36
|
+
Ye(n);
|
|
37
37
|
}, w = {
|
|
38
38
|
start: !0,
|
|
39
39
|
progress: 5e3,
|
|
@@ -42,7 +42,7 @@ const me = (e, n) => {
|
|
|
42
42
|
modeChange: !0,
|
|
43
43
|
debug: !1,
|
|
44
44
|
func: me
|
|
45
|
-
},
|
|
45
|
+
}, tt = {
|
|
46
46
|
start: !1,
|
|
47
47
|
progress: !1,
|
|
48
48
|
completed: !1,
|
|
@@ -52,7 +52,7 @@ const me = (e, n) => {
|
|
|
52
52
|
func: me
|
|
53
53
|
};
|
|
54
54
|
function ge(e) {
|
|
55
|
-
return e === !1 ?
|
|
55
|
+
return e === !1 ? tt : e === !0 || !e ? w : {
|
|
56
56
|
start: e.start ?? w.start,
|
|
57
57
|
progress: e.progress ?? w.progress,
|
|
58
58
|
completed: e.completed ?? w.completed,
|
|
@@ -62,7 +62,7 @@ function ge(e) {
|
|
|
62
62
|
func: e.func ?? w.func
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function rt(e, n) {
|
|
66
66
|
const t = e.now();
|
|
67
67
|
return {
|
|
68
68
|
startTime: t,
|
|
@@ -79,111 +79,111 @@ function nt(e, n) {
|
|
|
79
79
|
prevGcIterationsAsync: 0
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
class T extends
|
|
82
|
+
class T extends Xe {
|
|
83
83
|
}
|
|
84
|
-
const
|
|
85
|
-
function
|
|
84
|
+
const nt = 50, ot = 5;
|
|
85
|
+
function le(e, n) {
|
|
86
86
|
return typeof e == "number" ? { iterationsAsync: 0, iterationsSync: e } : e != null && typeof e == "object" ? e : n ? { iterationsAsync: 1, iterationsSync: 0 } : { iterationsAsync: 0, iterationsSync: 1 };
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
const t = n.log;
|
|
90
|
-
let o = null,
|
|
91
|
-
function l
|
|
92
|
-
o == null && (o = { error:
|
|
88
|
+
function it(e, n) {
|
|
89
|
+
const t = n.log, i = n.pauseDebuggerOnError ?? !0;
|
|
90
|
+
let o = null, a = 0;
|
|
91
|
+
function r(l, u, f) {
|
|
92
|
+
o == null && (o = { error: l, args: u, tests: f }, t.error && t.func(
|
|
93
93
|
"error",
|
|
94
|
-
`[test-variants] error variant: ${z(
|
|
95
|
-
tests: ${
|
|
96
|
-
${z(
|
|
94
|
+
`[test-variants] error variant: ${z(u, { pretty: !0 })}
|
|
95
|
+
tests: ${f}
|
|
96
|
+
${z(l)}`
|
|
97
97
|
));
|
|
98
98
|
const d = Date.now();
|
|
99
|
-
if (Date.now() - d >
|
|
99
|
+
if (i && Function("debugger")(), Date.now() - d > nt && a < ot) {
|
|
100
100
|
t.func(
|
|
101
101
|
"debug",
|
|
102
|
-
`[test-variants] debug iteration: ${
|
|
103
|
-
),
|
|
102
|
+
`[test-variants] debug iteration: ${a}`
|
|
103
|
+
), a++;
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
throw o = null, n.onError && n.onError(
|
|
106
|
+
const y = o;
|
|
107
|
+
throw o = null, n.onError && n.onError(y), y.error;
|
|
108
108
|
}
|
|
109
|
-
return function(
|
|
109
|
+
return function(u, f, d) {
|
|
110
110
|
try {
|
|
111
|
-
const
|
|
112
|
-
return M(
|
|
113
|
-
(
|
|
114
|
-
(
|
|
115
|
-
) :
|
|
116
|
-
} catch (
|
|
117
|
-
return
|
|
111
|
+
const h = e(u, d);
|
|
112
|
+
return M(h) ? h.then(
|
|
113
|
+
(y) => le(y, !0),
|
|
114
|
+
(y) => r(y, u, f)
|
|
115
|
+
) : le(h, !1);
|
|
116
|
+
} catch (h) {
|
|
117
|
+
return h instanceof T ? void 0 : r(h, u, f);
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
for (let
|
|
123
|
-
if (t ? t(e[
|
|
124
|
-
return
|
|
121
|
+
function U(e, n, t) {
|
|
122
|
+
for (let i = 0, o = e.length; i < o; i++)
|
|
123
|
+
if (t ? t(e[i], n) : e[i] === n)
|
|
124
|
+
return i;
|
|
125
125
|
return -1;
|
|
126
126
|
}
|
|
127
|
-
function ue(e, n, t,
|
|
128
|
-
const
|
|
129
|
-
for (let
|
|
130
|
-
const h =
|
|
131
|
-
|
|
127
|
+
function ue(e, n, t, i) {
|
|
128
|
+
const o = Object.keys(e.templates), a = {}, r = [], l = [], u = [], f = o.length;
|
|
129
|
+
for (let d = 0; d < f; d++) {
|
|
130
|
+
const h = o[d];
|
|
131
|
+
a[h] = void 0, r.push(-1), l.push(void 0), u.push(null);
|
|
132
132
|
}
|
|
133
133
|
return {
|
|
134
|
-
args:
|
|
135
|
-
argsNames:
|
|
134
|
+
args: a,
|
|
135
|
+
argsNames: o,
|
|
136
136
|
indexes: r,
|
|
137
|
-
argValues:
|
|
137
|
+
argValues: l,
|
|
138
138
|
argLimits: u,
|
|
139
139
|
attempts: 0,
|
|
140
140
|
templates: e,
|
|
141
141
|
limitArgOnError: t,
|
|
142
142
|
equals: n,
|
|
143
|
-
includeErrorVariant:
|
|
143
|
+
includeErrorVariant: i ?? !1
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
function O(e, n) {
|
|
147
|
-
const t = e.templates.templates[n],
|
|
148
|
-
let
|
|
149
|
-
if (typeof t == "function" ?
|
|
150
|
-
return
|
|
151
|
-
let
|
|
152
|
-
const r =
|
|
153
|
-
for (let
|
|
154
|
-
const u =
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
return
|
|
158
|
-
}
|
|
159
|
-
function
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
147
|
+
const t = e.templates.templates[n], i = e.templates.extra[n];
|
|
148
|
+
let o;
|
|
149
|
+
if (typeof t == "function" ? o = t(e.args) : o = t, i == null)
|
|
150
|
+
return o;
|
|
151
|
+
let a = null;
|
|
152
|
+
const r = i.length;
|
|
153
|
+
for (let l = 0; l < r; l++) {
|
|
154
|
+
const u = i[l];
|
|
155
|
+
U(o, u, e.equals) < 0 && (a == null ? a = [...o, u] : a.push(u));
|
|
156
|
+
}
|
|
157
|
+
return a ?? o;
|
|
158
|
+
}
|
|
159
|
+
function x(e, n, t) {
|
|
160
|
+
const i = e.argValues[n].length;
|
|
161
|
+
if (i === 0)
|
|
162
162
|
return -1;
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
166
|
-
let
|
|
167
|
-
if (typeof
|
|
163
|
+
const o = e.argLimits[n];
|
|
164
|
+
if (o == null)
|
|
165
|
+
return i - 1;
|
|
166
|
+
let a = e.limitArgOnError;
|
|
167
|
+
if (typeof a == "function") {
|
|
168
168
|
const r = e.argsNames[n];
|
|
169
|
-
|
|
169
|
+
a = a({
|
|
170
170
|
name: r,
|
|
171
171
|
values: e.argValues[n],
|
|
172
|
-
maxValueIndex:
|
|
172
|
+
maxValueIndex: o
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
return !t ||
|
|
175
|
+
return !t || a ? Math.min(o, i - 1) : i - 1;
|
|
176
176
|
}
|
|
177
177
|
function V(e) {
|
|
178
178
|
const n = e.indexes.length;
|
|
179
179
|
for (let t = 0; t < n; t++) {
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
180
|
+
const i = e.argLimits[t];
|
|
181
|
+
if (i == null)
|
|
182
182
|
return !1;
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
183
|
+
const o = e.indexes[t];
|
|
184
|
+
if (o > i)
|
|
185
185
|
return !0;
|
|
186
|
-
if (
|
|
186
|
+
if (o < i)
|
|
187
187
|
return !1;
|
|
188
188
|
}
|
|
189
189
|
return !e.includeErrorVariant;
|
|
@@ -195,24 +195,24 @@ function C(e) {
|
|
|
195
195
|
}
|
|
196
196
|
function pe(e) {
|
|
197
197
|
let n = !1, t = !0;
|
|
198
|
-
const
|
|
199
|
-
let
|
|
200
|
-
for (; r <
|
|
201
|
-
const
|
|
202
|
-
(
|
|
198
|
+
const i = e.indexes.length;
|
|
199
|
+
let o = i, a = !1, r = 0;
|
|
200
|
+
for (; r < i; r++) {
|
|
201
|
+
const l = e.argValues[r] == null;
|
|
202
|
+
(l || a) && (l && (n = !0), e.argValues[r] = O(
|
|
203
203
|
e,
|
|
204
204
|
e.argsNames[r]
|
|
205
205
|
));
|
|
206
|
-
const u =
|
|
206
|
+
const u = x(
|
|
207
207
|
e,
|
|
208
208
|
r,
|
|
209
|
-
r >
|
|
209
|
+
r > o
|
|
210
210
|
);
|
|
211
211
|
if (u < 0) {
|
|
212
212
|
t = !1, e.indexes[r] = -1;
|
|
213
213
|
break;
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
l && (e.indexes[r] = 0, e.args[e.argsNames[r]] = e.argValues[r][0]), (a || e.indexes[r] > u) && (e.indexes[r] = u, e.args[e.argsNames[r]] = e.argValues[r][u], a = !0), o === i && e.indexes[r] < u && (o = r);
|
|
216
216
|
}
|
|
217
217
|
if (V(e))
|
|
218
218
|
return C(e), !1;
|
|
@@ -221,23 +221,23 @@ function pe(e) {
|
|
|
221
221
|
for (r--; r >= 0; r--) {
|
|
222
222
|
if (e.argValues[r] == null)
|
|
223
223
|
continue;
|
|
224
|
-
let
|
|
225
|
-
const u =
|
|
226
|
-
if (
|
|
227
|
-
e.indexes[r] =
|
|
228
|
-
for (let
|
|
229
|
-
e.args[e.argsNames[
|
|
230
|
-
for (r++; r <
|
|
224
|
+
let l = r > o;
|
|
225
|
+
const u = x(e, r, l), f = e.indexes[r] + 1;
|
|
226
|
+
if (f <= u) {
|
|
227
|
+
e.indexes[r] = f, e.args[e.argsNames[r]] = e.argValues[r][f], f < u && (l = !0);
|
|
228
|
+
for (let d = r + 1; d < i; d++)
|
|
229
|
+
e.args[e.argsNames[d]] = void 0;
|
|
230
|
+
for (r++; r < i; r++) {
|
|
231
231
|
e.argValues[r] = O(
|
|
232
232
|
e,
|
|
233
233
|
e.argsNames[r]
|
|
234
234
|
);
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
235
|
+
const d = x(e, r, l);
|
|
236
|
+
if (d < 0)
|
|
237
237
|
break;
|
|
238
|
-
e.indexes[r] = 0, e.args[e.argsNames[r]] = e.argValues[r][0],
|
|
238
|
+
e.indexes[r] = 0, e.args[e.argsNames[r]] = e.argValues[r][0], d > 0 && (l = !0);
|
|
239
239
|
}
|
|
240
|
-
if (r >=
|
|
240
|
+
if (r >= i)
|
|
241
241
|
return V(e) ? (C(e), !1) : !0;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
@@ -246,73 +246,73 @@ function pe(e) {
|
|
|
246
246
|
function H(e) {
|
|
247
247
|
V(e) && C(e);
|
|
248
248
|
let n = !1, t = !0;
|
|
249
|
-
const
|
|
250
|
-
let
|
|
251
|
-
for (; r <
|
|
252
|
-
const
|
|
253
|
-
(
|
|
249
|
+
const i = e.indexes.length;
|
|
250
|
+
let o = i, a = !1, r = 0;
|
|
251
|
+
for (; r < i; r++) {
|
|
252
|
+
const l = e.argValues[r] == null;
|
|
253
|
+
(l || a) && (l && (n = !0), e.argValues[r] = O(
|
|
254
254
|
e,
|
|
255
255
|
e.argsNames[r]
|
|
256
256
|
));
|
|
257
|
-
const u =
|
|
257
|
+
const u = x(
|
|
258
258
|
e,
|
|
259
259
|
r,
|
|
260
|
-
r >
|
|
260
|
+
r > o
|
|
261
261
|
);
|
|
262
262
|
if (u < 0) {
|
|
263
263
|
t = !1, e.indexes[r] = -1;
|
|
264
264
|
break;
|
|
265
265
|
}
|
|
266
|
-
|
|
266
|
+
l && (e.indexes[r] = u, e.args[e.argsNames[r]] = e.argValues[r][u]), (a || e.indexes[r] > u) && (e.indexes[r] = u, e.args[e.argsNames[r]] = e.argValues[r][u], a = !0), o === i && e.indexes[r] < u && (o = r);
|
|
267
267
|
}
|
|
268
|
-
if ((n ||
|
|
268
|
+
if ((n || a) && t && !V(e))
|
|
269
269
|
return !0;
|
|
270
270
|
for (r--; r >= 0; r--) {
|
|
271
271
|
if (e.argValues[r] == null)
|
|
272
272
|
continue;
|
|
273
|
-
let
|
|
274
|
-
const u =
|
|
275
|
-
let
|
|
276
|
-
if (
|
|
277
|
-
e.indexes[r] =
|
|
278
|
-
for (let
|
|
279
|
-
e.args[e.argsNames[
|
|
280
|
-
for (r++; r <
|
|
273
|
+
let l = r > o;
|
|
274
|
+
const u = x(e, r, l);
|
|
275
|
+
let f = e.indexes[r] - 1;
|
|
276
|
+
if (f > u && (f = u), f >= 0) {
|
|
277
|
+
e.indexes[r] = f, e.args[e.argsNames[r]] = e.argValues[r][f], f < u && (l = !0);
|
|
278
|
+
for (let d = r + 1; d < i; d++)
|
|
279
|
+
e.args[e.argsNames[d]] = void 0;
|
|
280
|
+
for (r++; r < i; r++) {
|
|
281
281
|
e.argValues[r] = O(
|
|
282
282
|
e,
|
|
283
283
|
e.argsNames[r]
|
|
284
284
|
);
|
|
285
|
-
const
|
|
286
|
-
if (
|
|
285
|
+
const d = x(e, r, l);
|
|
286
|
+
if (d < 0)
|
|
287
287
|
break;
|
|
288
|
-
e.indexes[r] =
|
|
288
|
+
e.indexes[r] = d, e.args[e.argsNames[r]] = e.argValues[r][d], d > 0 && (l = !0);
|
|
289
289
|
}
|
|
290
|
-
if (r >=
|
|
290
|
+
if (r >= i)
|
|
291
291
|
return !0;
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
return C(e), !1;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function st(e, n) {
|
|
297
297
|
C(e);
|
|
298
|
-
const t = e.argsNames,
|
|
299
|
-
let
|
|
300
|
-
for (let
|
|
301
|
-
const r = t[
|
|
302
|
-
if (
|
|
298
|
+
const t = e.argsNames, i = t.length;
|
|
299
|
+
let o = !1;
|
|
300
|
+
for (let a = 0; a < i; a++) {
|
|
301
|
+
const r = t[a], l = n[r];
|
|
302
|
+
if (l === void 0)
|
|
303
303
|
return null;
|
|
304
|
-
e.argValues[
|
|
305
|
-
const u =
|
|
304
|
+
e.argValues[a] = O(e, r);
|
|
305
|
+
const u = x(e, a, o);
|
|
306
306
|
if (u < 0)
|
|
307
307
|
return null;
|
|
308
|
-
const
|
|
309
|
-
e.argValues[
|
|
310
|
-
|
|
308
|
+
const f = U(
|
|
309
|
+
e.argValues[a],
|
|
310
|
+
l,
|
|
311
311
|
e.equals
|
|
312
312
|
);
|
|
313
|
-
if (
|
|
313
|
+
if (f < 0 || f > u)
|
|
314
314
|
return null;
|
|
315
|
-
e.indexes[
|
|
315
|
+
e.indexes[a] = f, e.args[e.argsNames[a]] = e.argValues[a][f], e.indexes[a] < u && (o = !0);
|
|
316
316
|
}
|
|
317
317
|
return V(e) ? null : e.indexes.slice();
|
|
318
318
|
}
|
|
@@ -321,39 +321,39 @@ function at(e) {
|
|
|
321
321
|
if (n === 0)
|
|
322
322
|
return !1;
|
|
323
323
|
let t = !1;
|
|
324
|
-
for (let
|
|
325
|
-
e.argValues[
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
324
|
+
for (let i = 0; i < n; i++) {
|
|
325
|
+
e.argValues[i] = O(e, e.argsNames[i]);
|
|
326
|
+
const o = x(e, i, t);
|
|
327
|
+
if (o < 0)
|
|
328
328
|
return Math.random() < 0.5 ? pe(e) : H(e);
|
|
329
|
-
e.indexes[
|
|
329
|
+
e.indexes[i] = Math.floor(Math.random() * (o + 1)), e.args[e.argsNames[i]] = e.argValues[i][e.indexes[i]], e.indexes[i] < o && (t = !0);
|
|
330
330
|
}
|
|
331
331
|
return V(e) ? H(e) : !0;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function _(e) {
|
|
334
334
|
return e.mode === "forward" || e.mode === "backward";
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
const
|
|
338
|
-
if (typeof
|
|
339
|
-
if (
|
|
336
|
+
function lt(e, n, t, i) {
|
|
337
|
+
const o = n[t], a = e.templates[t];
|
|
338
|
+
if (typeof a != "function") {
|
|
339
|
+
if (U(a, o, i) >= 0)
|
|
340
340
|
return;
|
|
341
|
-
|
|
341
|
+
a.push(o);
|
|
342
342
|
return;
|
|
343
343
|
}
|
|
344
344
|
const r = e.extra[t];
|
|
345
345
|
if (r == null) {
|
|
346
|
-
e.extra[t] = [
|
|
346
|
+
e.extra[t] = [o];
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
|
-
|
|
349
|
+
U(r, o, i) >= 0 || r.push(o);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
for (const
|
|
353
|
-
if (Object.prototype.hasOwnProperty.call(n,
|
|
354
|
-
if (
|
|
351
|
+
function ut(e, n, t) {
|
|
352
|
+
for (const i in n)
|
|
353
|
+
if (Object.prototype.hasOwnProperty.call(n, i)) {
|
|
354
|
+
if (i === "seed")
|
|
355
355
|
continue;
|
|
356
|
-
|
|
356
|
+
lt(e, n, i, t);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
function ce(e, n) {
|
|
@@ -366,38 +366,38 @@ function ce(e, n) {
|
|
|
366
366
|
}
|
|
367
367
|
return !0;
|
|
368
368
|
}
|
|
369
|
-
const
|
|
370
|
-
function
|
|
369
|
+
const ct = [{ mode: "forward" }];
|
|
370
|
+
function ft(e) {
|
|
371
371
|
const {
|
|
372
372
|
argsTemplates: n,
|
|
373
373
|
equals: t,
|
|
374
|
-
limitArgOnError:
|
|
375
|
-
includeErrorVariant:
|
|
376
|
-
getSeed:
|
|
374
|
+
limitArgOnError: i,
|
|
375
|
+
includeErrorVariant: o,
|
|
376
|
+
getSeed: a,
|
|
377
377
|
iterationModes: r,
|
|
378
|
-
onModeChange:
|
|
378
|
+
onModeChange: l,
|
|
379
379
|
limitCompletionCount: u,
|
|
380
|
-
limitTests:
|
|
381
|
-
limitTime:
|
|
380
|
+
limitTests: f,
|
|
381
|
+
limitTime: d
|
|
382
382
|
} = e, h = e.timeController ?? Q, y = {
|
|
383
|
-
templates:
|
|
383
|
+
templates: He(n),
|
|
384
384
|
extra: {}
|
|
385
|
-
}, p = r == null || r.length === 0 ?
|
|
386
|
-
let
|
|
385
|
+
}, p = r == null || r.length === 0 ? ct : r, b = [];
|
|
386
|
+
let E = null, L = null, g = 0, S = 0, I = !1, P = 0;
|
|
387
387
|
function $() {
|
|
388
|
-
I || (I = !0, P = h.now(),
|
|
388
|
+
I || (I = !0, P = h.now(), Ee(), g = 0, re(), we());
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function Ee() {
|
|
391
391
|
for (let s = 0, c = p.length; s < c; s++)
|
|
392
|
-
b.push(
|
|
392
|
+
b.push(Se());
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function Se() {
|
|
395
395
|
return {
|
|
396
396
|
navigationState: ue(
|
|
397
397
|
y,
|
|
398
398
|
t ?? null,
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
i ?? null,
|
|
400
|
+
o ?? null
|
|
401
401
|
),
|
|
402
402
|
cycleCount: 0,
|
|
403
403
|
completedCount: 0,
|
|
@@ -406,8 +406,8 @@ function dt(e) {
|
|
|
406
406
|
startTime: null
|
|
407
407
|
};
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
|
|
409
|
+
function we() {
|
|
410
|
+
E = ue(
|
|
411
411
|
y,
|
|
412
412
|
t ?? null,
|
|
413
413
|
// Initial values; overwritten in calcIndexes before each use
|
|
@@ -416,19 +416,19 @@ function dt(e) {
|
|
|
416
416
|
);
|
|
417
417
|
}
|
|
418
418
|
function re() {
|
|
419
|
-
|
|
419
|
+
l?.({
|
|
420
420
|
mode: p[g],
|
|
421
421
|
modeIndex: g,
|
|
422
|
-
tests:
|
|
422
|
+
tests: S
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
$(), ce(y.templates, s) &&
|
|
425
|
+
function xe(s) {
|
|
426
|
+
$(), ce(y.templates, s) && ut(y, s, t);
|
|
427
427
|
}
|
|
428
428
|
function ne(s, c) {
|
|
429
|
-
return $(), ce(y.templates, s) ? (
|
|
429
|
+
return $(), ce(y.templates, s) ? (E.limitArgOnError = c?.limitArg ?? i ?? null, E.includeErrorVariant = c?.includeLimit ?? o ?? !1, st(E, s)) : null;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function Me(s) {
|
|
432
432
|
const c = s?.args;
|
|
433
433
|
if (c == null)
|
|
434
434
|
return;
|
|
@@ -438,49 +438,49 @@ function dt(e) {
|
|
|
438
438
|
L = {
|
|
439
439
|
args: c,
|
|
440
440
|
error: s?.error,
|
|
441
|
-
tests: s?.tests ??
|
|
442
|
-
},
|
|
443
|
-
for (let v = 0,
|
|
441
|
+
tests: s?.tests ?? S
|
|
442
|
+
}, E.argLimits = m;
|
|
443
|
+
for (let v = 0, D = b.length; v < D; v++) {
|
|
444
444
|
const j = b[v].navigationState;
|
|
445
445
|
j.argLimits = m;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
function
|
|
450
|
-
return $(),
|
|
449
|
+
function Te() {
|
|
450
|
+
return $(), Ve();
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function Ve() {
|
|
453
453
|
for (; ; ) {
|
|
454
|
-
if (!
|
|
454
|
+
if (!Ie())
|
|
455
455
|
return null;
|
|
456
456
|
for (; ; ) {
|
|
457
|
-
const s =
|
|
457
|
+
const s = _e();
|
|
458
458
|
if (s != null)
|
|
459
|
-
return b[g].testsInLastTurn++,
|
|
460
|
-
if (
|
|
461
|
-
if (
|
|
459
|
+
return b[g].testsInLastTurn++, S++, s;
|
|
460
|
+
if (Pe()) {
|
|
461
|
+
if (!$e())
|
|
462
462
|
return null;
|
|
463
|
-
|
|
463
|
+
De();
|
|
464
464
|
break;
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
+
function Ie() {
|
|
470
|
+
return !(Ae() || Ce() || G() && (Oe() || !Le()) || !Ne());
|
|
471
|
+
}
|
|
469
472
|
function Ae() {
|
|
470
|
-
return
|
|
473
|
+
return f != null && S >= f;
|
|
471
474
|
}
|
|
472
475
|
function Ce() {
|
|
473
|
-
return d != null &&
|
|
476
|
+
return d != null && h.now() - P >= d;
|
|
474
477
|
}
|
|
475
478
|
function Oe() {
|
|
476
|
-
return f != null && h.now() - P >= f;
|
|
477
|
-
}
|
|
478
|
-
function Le() {
|
|
479
479
|
if (!G())
|
|
480
480
|
throw new Error("Unexpected behavior");
|
|
481
481
|
return u != null && u <= 0;
|
|
482
482
|
}
|
|
483
|
-
function
|
|
483
|
+
function Le() {
|
|
484
484
|
if (!G())
|
|
485
485
|
throw new Error("Unexpected behavior");
|
|
486
486
|
for (let s = 0, c = p.length; s < c; s++)
|
|
@@ -488,20 +488,20 @@ function dt(e) {
|
|
|
488
488
|
return !0;
|
|
489
489
|
return !1;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function Ne() {
|
|
492
492
|
for (let s = 0, c = p.length; s < c; s++)
|
|
493
493
|
if (k(s))
|
|
494
494
|
return !0;
|
|
495
495
|
return !1;
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function Pe() {
|
|
498
498
|
g++;
|
|
499
499
|
const s = g >= p.length;
|
|
500
500
|
return s && (g = 0), re(), s;
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function $e() {
|
|
503
503
|
if (G()) {
|
|
504
|
-
const s =
|
|
504
|
+
const s = Ge();
|
|
505
505
|
if (u != null && s >= u)
|
|
506
506
|
return !1;
|
|
507
507
|
}
|
|
@@ -509,15 +509,15 @@ function dt(e) {
|
|
|
509
509
|
}
|
|
510
510
|
function G() {
|
|
511
511
|
for (let s = 0, c = p.length; s < c; s++)
|
|
512
|
-
if (
|
|
512
|
+
if (_(p[s]))
|
|
513
513
|
return !0;
|
|
514
514
|
return !1;
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function Ge() {
|
|
517
517
|
let s = !1, c = 1 / 0;
|
|
518
518
|
for (let m = 0, v = b.length; m < v; m++) {
|
|
519
|
-
const
|
|
520
|
-
|
|
519
|
+
const D = b[m], j = p[m];
|
|
520
|
+
_(j) && (s = !0, k(m) && D.completedCount < c && (c = D.completedCount));
|
|
521
521
|
}
|
|
522
522
|
if (!s)
|
|
523
523
|
throw new Error("Unexpected behavior");
|
|
@@ -527,66 +527,66 @@ function dt(e) {
|
|
|
527
527
|
const c = p[s], m = b[s];
|
|
528
528
|
return c.limitTests != null && c.limitTests <= 0 || A(c) && (c.cycles != null && c.cycles <= 0 || c.attemptsPerVariant != null && c.attemptsPerVariant <= 0) ? !1 : m.tryNextVariantAttempts < 2;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function De() {
|
|
531
531
|
g = 0;
|
|
532
532
|
for (let s = 0, c = b.length; s < c; s++) {
|
|
533
533
|
const m = b[s];
|
|
534
534
|
m.testsInLastTurn = 0, m.startTime = null;
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function _e() {
|
|
538
538
|
let s = 0;
|
|
539
539
|
for (; s < 2; ) {
|
|
540
|
-
if (!
|
|
540
|
+
if (!qe())
|
|
541
541
|
return null;
|
|
542
|
-
const c =
|
|
542
|
+
const c = Fe();
|
|
543
543
|
if (c != null)
|
|
544
544
|
return c;
|
|
545
|
-
if (A(p[g]) &&
|
|
545
|
+
if (A(p[g]) && ke())
|
|
546
546
|
return null;
|
|
547
547
|
s++;
|
|
548
548
|
}
|
|
549
549
|
return null;
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function qe() {
|
|
552
552
|
const s = p[g];
|
|
553
|
-
return !(
|
|
553
|
+
return !(Ue() || Be() || A(s) && !Re(g));
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function Ue() {
|
|
556
556
|
const s = p[g], c = b[g];
|
|
557
557
|
return s.limitTests != null && c.testsInLastTurn >= s.limitTests;
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function Be() {
|
|
560
560
|
const s = p[g], c = b[g];
|
|
561
561
|
return s.limitTime != null && c.startTime != null && h.now() - c.startTime >= s.limitTime;
|
|
562
562
|
}
|
|
563
563
|
function A(s) {
|
|
564
|
-
return
|
|
564
|
+
return _(s);
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function Re(s) {
|
|
567
567
|
const c = p[s], m = b[s];
|
|
568
568
|
if (!A(c))
|
|
569
569
|
throw new Error("Unexpected behavior");
|
|
570
570
|
return m.cycleCount < (c.cycles ?? 1);
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function ke() {
|
|
573
573
|
const s = p[g], c = b[g];
|
|
574
574
|
if (!A(s))
|
|
575
575
|
throw new Error("Unexpected behavior");
|
|
576
576
|
return c.cycleCount++, c.cycleCount >= (s.cycles ?? 1) ? (c.cycleCount = 0, c.completedCount++, !0) : !1;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function Fe() {
|
|
579
579
|
const s = p[g], c = b[g], m = c.navigationState;
|
|
580
580
|
if (N(s)) {
|
|
581
581
|
if (F())
|
|
582
582
|
return null;
|
|
583
|
-
const v =
|
|
583
|
+
const v = je();
|
|
584
584
|
if (v != null)
|
|
585
585
|
return c.startTime == null && (c.startTime = h.now()), v;
|
|
586
586
|
}
|
|
587
|
-
return
|
|
587
|
+
return ze() ? (c.tryNextVariantAttempts = 0, N(s) && We(), c.startTime == null && (c.startTime = h.now()), oe(m.args)) : (c.tryNextVariantAttempts++, null);
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function je() {
|
|
590
590
|
const s = p[g], m = b[g].navigationState;
|
|
591
591
|
if (!N(s))
|
|
592
592
|
throw new Error("Unexpected behavior");
|
|
@@ -595,7 +595,7 @@ function dt(e) {
|
|
|
595
595
|
const v = s.attemptsPerVariant ?? 1;
|
|
596
596
|
return m.attempts > 0 && m.attempts < v ? V(m) ? null : (m.attempts++, oe(m.args)) : null;
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function We() {
|
|
599
599
|
const s = p[g], m = b[g].navigationState;
|
|
600
600
|
if (!N(s))
|
|
601
601
|
throw new Error("Unexpected behavior");
|
|
@@ -604,7 +604,7 @@ function dt(e) {
|
|
|
604
604
|
m.attempts = 1;
|
|
605
605
|
}
|
|
606
606
|
function N(s) {
|
|
607
|
-
return
|
|
607
|
+
return _(s);
|
|
608
608
|
}
|
|
609
609
|
function F() {
|
|
610
610
|
const s = p[g];
|
|
@@ -612,7 +612,7 @@ function dt(e) {
|
|
|
612
612
|
throw new Error("Unexpected behavior");
|
|
613
613
|
return (s.attemptsPerVariant ?? 1) <= 0;
|
|
614
614
|
}
|
|
615
|
-
function
|
|
615
|
+
function ze() {
|
|
616
616
|
const s = p[g], m = b[g].navigationState;
|
|
617
617
|
switch (s.mode) {
|
|
618
618
|
case "forward":
|
|
@@ -627,7 +627,7 @@ function dt(e) {
|
|
|
627
627
|
}
|
|
628
628
|
function oe(s) {
|
|
629
629
|
const c = { ...s };
|
|
630
|
-
return
|
|
630
|
+
return a != null && (c.seed = a({ tests: S })), c;
|
|
631
631
|
}
|
|
632
632
|
return {
|
|
633
633
|
get limit() {
|
|
@@ -643,36 +643,36 @@ function dt(e) {
|
|
|
643
643
|
return b;
|
|
644
644
|
},
|
|
645
645
|
get tests() {
|
|
646
|
-
return
|
|
646
|
+
return S;
|
|
647
647
|
},
|
|
648
648
|
calcIndexes: ne,
|
|
649
|
-
extendTemplates:
|
|
650
|
-
addLimit:
|
|
651
|
-
next:
|
|
649
|
+
extendTemplates: xe,
|
|
650
|
+
addLimit: Me,
|
|
651
|
+
next: Te
|
|
652
652
|
};
|
|
653
653
|
}
|
|
654
654
|
function ee(e) {
|
|
655
655
|
if (e == null || e <= 0)
|
|
656
656
|
throw new Error(`Iterations = ${e}`);
|
|
657
657
|
e--;
|
|
658
|
-
const n =
|
|
658
|
+
const n = Je().then(() => e);
|
|
659
659
|
return e <= 0 ? n : n.then(ee);
|
|
660
660
|
}
|
|
661
|
-
function
|
|
662
|
-
const
|
|
661
|
+
function dt(e, n, t) {
|
|
662
|
+
const i = n.limit ? {
|
|
663
663
|
error: n.limit.error,
|
|
664
664
|
args: n.limit.args,
|
|
665
665
|
tests: n.limit.tests
|
|
666
666
|
} : null;
|
|
667
|
-
if (
|
|
668
|
-
throw
|
|
667
|
+
if (i && !t)
|
|
668
|
+
throw i.error;
|
|
669
669
|
return {
|
|
670
670
|
iterations: e.iterations,
|
|
671
|
-
bestError:
|
|
671
|
+
bestError: i
|
|
672
672
|
};
|
|
673
673
|
}
|
|
674
674
|
const fe = 2 ** 31;
|
|
675
|
-
function
|
|
675
|
+
function mt(e) {
|
|
676
676
|
if (e == null)
|
|
677
677
|
return { parallel: 1, sequentialOnError: !1 };
|
|
678
678
|
if (typeof e == "boolean")
|
|
@@ -689,8 +689,8 @@ function gt(e) {
|
|
|
689
689
|
sequentialOnError: e.sequentialOnError ?? !1
|
|
690
690
|
};
|
|
691
691
|
}
|
|
692
|
-
function
|
|
693
|
-
const n = e?.saveErrorVariants, t = n && e.createSaveErrorVariantsStore ? e.createSaveErrorVariantsStore(n) : null,
|
|
692
|
+
function gt(e) {
|
|
693
|
+
const n = e?.saveErrorVariants, t = n && e.createSaveErrorVariantsStore ? e.createSaveErrorVariantsStore(n) : null, i = e?.findBestError, { parallel: o, sequentialOnError: a } = mt(
|
|
694
694
|
e?.parallel
|
|
695
695
|
);
|
|
696
696
|
return {
|
|
@@ -700,61 +700,61 @@ function pt(e) {
|
|
|
700
700
|
GC_Interval: e?.GC_Interval ?? 1e3,
|
|
701
701
|
logOptions: ge(e?.log),
|
|
702
702
|
abortSignalExternal: e?.abortSignal,
|
|
703
|
-
findBestError:
|
|
704
|
-
dontThrowIfError:
|
|
703
|
+
findBestError: i,
|
|
704
|
+
dontThrowIfError: i?.dontThrowIfError,
|
|
705
705
|
timeController: e?.timeController ?? Q,
|
|
706
|
-
parallel:
|
|
707
|
-
sequentialOnError:
|
|
706
|
+
parallel: o,
|
|
707
|
+
sequentialOnError: a
|
|
708
708
|
};
|
|
709
709
|
}
|
|
710
710
|
function B(e, n, t) {
|
|
711
|
-
const { options:
|
|
712
|
-
if (!
|
|
711
|
+
const { options: i, variantsIterator: o } = e, a = o.limit?.args ?? n;
|
|
712
|
+
if (!i.store)
|
|
713
713
|
return;
|
|
714
|
-
const r =
|
|
714
|
+
const r = i.store.save(a);
|
|
715
715
|
if (t)
|
|
716
716
|
return r;
|
|
717
717
|
}
|
|
718
|
-
function
|
|
719
|
-
const { abortControllerParallel:
|
|
718
|
+
function pt(e, n, t, i) {
|
|
719
|
+
const { abortControllerParallel: o, state: a, options: r } = e, { logOptions: l } = r;
|
|
720
720
|
if (e.options.findBestError)
|
|
721
|
-
e.variantsIterator.addLimit({ args: n, error: t, tests:
|
|
721
|
+
e.variantsIterator.addLimit({ args: n, error: t, tests: i }), a.debugMode = !1, B(e, n, !1), r.sequentialOnError && !o.signal.aborted ? (l.debug && l.func(
|
|
722
722
|
"debug",
|
|
723
723
|
"[test-variants] sequentialOnError: aborting parallel, switching to sequential"
|
|
724
|
-
),
|
|
724
|
+
), o.abort(new T())) : l.debug && l.func(
|
|
725
725
|
"debug",
|
|
726
726
|
"[test-variants] parallel error in findBestError mode, continuing with new limits"
|
|
727
727
|
);
|
|
728
728
|
else {
|
|
729
|
-
if (
|
|
729
|
+
if (o.signal.aborted)
|
|
730
730
|
return;
|
|
731
|
-
B(e, n, !1),
|
|
731
|
+
B(e, n, !1), o.abort(t);
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
|
-
function de(e, n, t,
|
|
735
|
-
const { state:
|
|
734
|
+
function de(e, n, t, i) {
|
|
735
|
+
const { state: o } = e;
|
|
736
736
|
if (e.options.findBestError) {
|
|
737
|
-
e.variantsIterator.addLimit({ args: n, error: t, tests:
|
|
737
|
+
e.variantsIterator.addLimit({ args: n, error: t, tests: i });
|
|
738
738
|
const r = B(e, n, !0);
|
|
739
739
|
if (r)
|
|
740
740
|
return r.then(() => {
|
|
741
|
-
|
|
741
|
+
o.debugMode = !1;
|
|
742
742
|
});
|
|
743
|
-
|
|
743
|
+
o.debugMode = !1;
|
|
744
744
|
return;
|
|
745
745
|
}
|
|
746
|
-
const
|
|
747
|
-
if (
|
|
748
|
-
return
|
|
746
|
+
const a = B(e, n, !0);
|
|
747
|
+
if (a)
|
|
748
|
+
return a.then(() => {
|
|
749
749
|
throw t;
|
|
750
750
|
});
|
|
751
751
|
throw t;
|
|
752
752
|
}
|
|
753
|
-
function
|
|
754
|
-
const { GC_Iterations: t, GC_IterationsAsync:
|
|
755
|
-
return t > 0 && e.state.iterations - e.state.prevGcIterations >= t ||
|
|
753
|
+
function ht(e, n) {
|
|
754
|
+
const { GC_Iterations: t, GC_IterationsAsync: i, GC_Interval: o } = e.options;
|
|
755
|
+
return t > 0 && e.state.iterations - e.state.prevGcIterations >= t || i > 0 && e.state.iterationsAsync - e.state.prevGcIterationsAsync >= i || o > 0 && n - e.state.prevGcTime >= o;
|
|
756
756
|
}
|
|
757
|
-
async function
|
|
757
|
+
async function bt(e, n) {
|
|
758
758
|
e.prevGcIterations = e.iterations, e.prevGcIterationsAsync = e.iterationsAsync, e.prevGcTime = n, await ee(1);
|
|
759
759
|
}
|
|
760
760
|
function te(e) {
|
|
@@ -771,53 +771,53 @@ function J(e) {
|
|
|
771
771
|
const t = e / (1024 * 1024);
|
|
772
772
|
return t >= 10 ? `${Math.round(t)}MB` : `${t.toFixed(1)}MB`;
|
|
773
773
|
}
|
|
774
|
-
function
|
|
774
|
+
function yt(e, n) {
|
|
775
775
|
if (!e)
|
|
776
776
|
return `mode[${n}]: null`;
|
|
777
777
|
let t = `mode[${n}]: ${e.mode}`;
|
|
778
778
|
return (e.mode === "forward" || e.mode === "backward") && (e.cycles != null && (t += `, cycles=${e.cycles}`), e.attemptsPerVariant != null && (t += `, attempts=${e.attemptsPerVariant}`)), e.limitTime != null && (t += `, limitTime=${te(e.limitTime)}`), e.limitTests != null && (t += `, limitTests=${e.limitTests}`), t;
|
|
779
779
|
}
|
|
780
780
|
function he(e, n) {
|
|
781
|
-
const t = e - n,
|
|
782
|
-
return `${J(e)} (${
|
|
781
|
+
const t = e - n, i = t >= 0 ? "+" : "";
|
|
782
|
+
return `${J(e)} (${i}${J(t)})`;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function vt(e, n) {
|
|
785
785
|
if (!e.start)
|
|
786
786
|
return;
|
|
787
787
|
let t = "[test-variants] start";
|
|
788
788
|
n != null && (t += `, memory: ${J(n)}`), e.func("start", t);
|
|
789
789
|
}
|
|
790
|
-
function
|
|
791
|
-
const { options: n, state: t } = e, { logOptions:
|
|
792
|
-
if (!
|
|
790
|
+
function Et(e) {
|
|
791
|
+
const { options: n, state: t } = e, { logOptions: i, timeController: o } = n;
|
|
792
|
+
if (!i.completed)
|
|
793
793
|
return;
|
|
794
|
-
const
|
|
795
|
-
let r = `[test-variants] end, tests: ${t.tests} (${te(
|
|
794
|
+
const a = o.now() - t.startTime;
|
|
795
|
+
let r = `[test-variants] end, tests: ${t.tests} (${te(a)}), async: ${t.iterationsAsync}`;
|
|
796
796
|
if (t.startMemory != null) {
|
|
797
|
-
const
|
|
798
|
-
|
|
797
|
+
const l = Y();
|
|
798
|
+
l != null && (r += `, memory: ${he(l, t.startMemory)}`);
|
|
799
799
|
}
|
|
800
|
-
|
|
800
|
+
i.func("completed", r);
|
|
801
801
|
}
|
|
802
802
|
function be(e) {
|
|
803
|
-
const { options: n, state: t } = e, { logOptions:
|
|
804
|
-
!
|
|
803
|
+
const { options: n, state: t } = e, { logOptions: i } = n, o = t.pendingModeChange;
|
|
804
|
+
!i.modeChange || o == null || (i.func(
|
|
805
805
|
"modeChange",
|
|
806
|
-
`[test-variants] ${
|
|
806
|
+
`[test-variants] ${yt(o.mode, o.modeIndex)}`
|
|
807
807
|
), t.pendingModeChange = null);
|
|
808
808
|
}
|
|
809
|
-
function
|
|
810
|
-
const { options: n, state: t } = e, { logOptions:
|
|
811
|
-
if (!
|
|
809
|
+
function St(e) {
|
|
810
|
+
const { options: n, state: t } = e, { logOptions: i, timeController: o } = n, a = o.now();
|
|
811
|
+
if (!i.progress || a - t.prevLogTime < i.progress)
|
|
812
812
|
return !1;
|
|
813
813
|
be(e);
|
|
814
|
-
const r =
|
|
815
|
-
let
|
|
814
|
+
const r = a - t.startTime;
|
|
815
|
+
let l = `[test-variants] tests: ${t.tests} (${te(r)}), async: ${t.iterationsAsync}`;
|
|
816
816
|
if (t.prevLogMemory != null) {
|
|
817
817
|
const u = Y();
|
|
818
|
-
u != null && (
|
|
818
|
+
u != null && (l += `, memory: ${he(u, t.prevLogMemory)}`, t.prevLogMemory = u);
|
|
819
819
|
}
|
|
820
|
-
return
|
|
820
|
+
return i.func("progress", l), t.prevLogTime = a, !0;
|
|
821
821
|
}
|
|
822
822
|
function X(e, n) {
|
|
823
823
|
e.debugMode = !1, n && (e.iterationsAsync += n.iterationsAsync, e.iterations += n.iterationsSync + n.iterationsAsync);
|
|
@@ -826,40 +826,40 @@ function Z(e) {
|
|
|
826
826
|
e.state.debugMode = !0, e.abortControllerParallel.abort(new T());
|
|
827
827
|
}
|
|
828
828
|
function ye(e, n) {
|
|
829
|
-
const { testRun: t, testOptions:
|
|
830
|
-
|
|
829
|
+
const { testRun: t, testOptions: i, state: o } = e, a = o.tests;
|
|
830
|
+
o.tests++;
|
|
831
831
|
try {
|
|
832
|
-
const r = t(n,
|
|
832
|
+
const r = t(n, a, i);
|
|
833
833
|
if (M(r))
|
|
834
834
|
return r.then(
|
|
835
|
-
(
|
|
836
|
-
if (!
|
|
835
|
+
(l) => {
|
|
836
|
+
if (!l) {
|
|
837
837
|
Z(e);
|
|
838
838
|
return;
|
|
839
839
|
}
|
|
840
|
-
X(
|
|
840
|
+
X(o, l);
|
|
841
841
|
},
|
|
842
|
-
(
|
|
842
|
+
(l) => de(e, n, l, a)
|
|
843
843
|
);
|
|
844
844
|
if (!r) {
|
|
845
845
|
Z(e);
|
|
846
846
|
return;
|
|
847
847
|
}
|
|
848
|
-
X(
|
|
848
|
+
X(o, r);
|
|
849
849
|
} catch (r) {
|
|
850
|
-
return r instanceof T ? void 0 : de(e, n, r,
|
|
850
|
+
return r instanceof T ? void 0 : de(e, n, r, a);
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
|
-
function
|
|
854
|
-
const { pool: t, abortSignal:
|
|
853
|
+
function wt(e, n) {
|
|
854
|
+
const { pool: t, abortSignal: i, testRun: o, testOptionsParallel: a, state: r } = e;
|
|
855
855
|
if (!t)
|
|
856
856
|
return;
|
|
857
|
-
const
|
|
857
|
+
const l = r.tests;
|
|
858
858
|
r.tests++, (async () => {
|
|
859
859
|
try {
|
|
860
|
-
if (
|
|
860
|
+
if (i.aborted)
|
|
861
861
|
return;
|
|
862
|
-
let u =
|
|
862
|
+
let u = o(n, l, a);
|
|
863
863
|
if (M(u) && (u = await u), !u) {
|
|
864
864
|
Z(e);
|
|
865
865
|
return;
|
|
@@ -868,20 +868,20 @@ function Et(e, n) {
|
|
|
868
868
|
} catch (u) {
|
|
869
869
|
if (u instanceof T)
|
|
870
870
|
return;
|
|
871
|
-
|
|
871
|
+
pt(e, n, u, l);
|
|
872
872
|
} finally {
|
|
873
873
|
t.release(1);
|
|
874
874
|
}
|
|
875
875
|
})();
|
|
876
876
|
}
|
|
877
877
|
function ve(e) {
|
|
878
|
-
const { options: n, state: t } = e, { logOptions:
|
|
879
|
-
if (!
|
|
878
|
+
const { options: n, state: t } = e, { logOptions: i, timeController: o, GC_Interval: a } = n;
|
|
879
|
+
if (!i.progress && !a)
|
|
880
880
|
return;
|
|
881
|
-
|
|
882
|
-
const r =
|
|
883
|
-
if (
|
|
884
|
-
return
|
|
881
|
+
St(e);
|
|
882
|
+
const r = o.now();
|
|
883
|
+
if (ht(e, r))
|
|
884
|
+
return bt(t, r);
|
|
885
885
|
}
|
|
886
886
|
function R(e) {
|
|
887
887
|
return e.options.abortSignalExternal?.aborted ?? !1;
|
|
@@ -889,140 +889,133 @@ function R(e) {
|
|
|
889
889
|
function K(e) {
|
|
890
890
|
return e.abortSignal.aborted;
|
|
891
891
|
}
|
|
892
|
-
function Se(e, n) {
|
|
893
|
-
return e.state.debugMode ? n : e.variantsIterator.next();
|
|
894
|
-
}
|
|
895
892
|
async function W(e, n) {
|
|
896
|
-
const { pool: t, state:
|
|
897
|
-
let
|
|
893
|
+
const { pool: t, state: i, options: o } = e, { parallel: a, logOptions: r } = o;
|
|
894
|
+
let l = null;
|
|
898
895
|
for (; !R(e); ) {
|
|
899
896
|
const u = t && !K(e);
|
|
900
|
-
let
|
|
901
|
-
u && (t.hold(1) || await
|
|
897
|
+
let f = !1;
|
|
898
|
+
u && (t.hold(1) || await ae({ pool: t, count: 1, hold: !0 }), f = !0);
|
|
902
899
|
try {
|
|
903
|
-
if (
|
|
900
|
+
if (n != null ? (l = n, n = null) : e.state.debugMode || (l = e.variantsIterator.next()), l == null)
|
|
904
901
|
break;
|
|
905
|
-
const
|
|
906
|
-
if (M(
|
|
907
|
-
a = null;
|
|
902
|
+
const d = ve(e);
|
|
903
|
+
if (M(d) && await d, R(e))
|
|
908
904
|
continue;
|
|
909
|
-
}
|
|
910
905
|
if (u)
|
|
911
|
-
|
|
906
|
+
wt(e, l), f = !1;
|
|
912
907
|
else {
|
|
913
908
|
r.debug && t && K(e) && r.func(
|
|
914
909
|
"debug",
|
|
915
|
-
`[test-variants] parallel aborted, running sequential: tests=${
|
|
910
|
+
`[test-variants] parallel aborted, running sequential: tests=${i.tests}`
|
|
916
911
|
);
|
|
917
|
-
const h = ye(e,
|
|
912
|
+
const h = ye(e, l);
|
|
918
913
|
M(h) && await h;
|
|
919
914
|
}
|
|
920
|
-
a = null;
|
|
921
915
|
} finally {
|
|
922
|
-
|
|
916
|
+
f && t.release(1);
|
|
923
917
|
}
|
|
924
918
|
}
|
|
925
|
-
t && (await
|
|
919
|
+
t && (await ae({ pool: t, count: a, hold: !0 }), t.release(a));
|
|
926
920
|
}
|
|
927
|
-
function
|
|
928
|
-
const { pool: n, state: t, options:
|
|
921
|
+
function xt(e) {
|
|
922
|
+
const { pool: n, state: t, options: i } = e, { logOptions: o } = i;
|
|
929
923
|
if (n)
|
|
930
924
|
return W(e);
|
|
931
|
-
let
|
|
932
|
-
for (; !R(e) && (
|
|
925
|
+
let a = null;
|
|
926
|
+
for (; !R(e) && (e.state.debugMode || (a = e.variantsIterator.next()), a != null); ) {
|
|
933
927
|
const r = ve(e);
|
|
934
|
-
if (M(r))
|
|
935
|
-
|
|
936
|
-
return r.then(() => W(e, u));
|
|
937
|
-
}
|
|
928
|
+
if (M(r))
|
|
929
|
+
return r.then(() => W(e, a));
|
|
938
930
|
if (R(e))
|
|
939
931
|
continue;
|
|
940
|
-
|
|
932
|
+
o.debug && K(e) && o.func(
|
|
941
933
|
"debug",
|
|
942
934
|
`[test-variants] parallel aborted, running sequential: tests=${t.tests}`
|
|
943
935
|
);
|
|
944
|
-
const
|
|
945
|
-
if (M(
|
|
946
|
-
return
|
|
936
|
+
const l = ye(e, a);
|
|
937
|
+
if (M(l))
|
|
938
|
+
return l.then(() => W(e));
|
|
947
939
|
}
|
|
948
940
|
}
|
|
949
|
-
async function
|
|
950
|
-
const
|
|
951
|
-
store:
|
|
941
|
+
async function Mt(e, n, t, i) {
|
|
942
|
+
const o = gt(i), {
|
|
943
|
+
store: a,
|
|
952
944
|
logOptions: r,
|
|
953
|
-
abortSignalExternal:
|
|
945
|
+
abortSignalExternal: l,
|
|
954
946
|
findBestError: u,
|
|
955
|
-
dontThrowIfError:
|
|
956
|
-
timeController:
|
|
947
|
+
dontThrowIfError: f,
|
|
948
|
+
timeController: d,
|
|
957
949
|
parallel: h
|
|
958
|
-
} =
|
|
959
|
-
|
|
950
|
+
} = o, y = new se(), p = new se(), b = ie(
|
|
951
|
+
l,
|
|
960
952
|
y.signal
|
|
961
|
-
),
|
|
953
|
+
), E = ie(
|
|
962
954
|
b,
|
|
963
955
|
p.signal
|
|
964
956
|
), L = {
|
|
965
957
|
abortSignal: b,
|
|
966
|
-
timeController:
|
|
958
|
+
timeController: d
|
|
967
959
|
}, g = {
|
|
968
|
-
abortSignal:
|
|
969
|
-
timeController:
|
|
960
|
+
abortSignal: E,
|
|
961
|
+
timeController: d
|
|
970
962
|
};
|
|
971
|
-
|
|
963
|
+
a && await a.replay({
|
|
972
964
|
testRun: e,
|
|
973
965
|
variantsIterator: n,
|
|
974
966
|
testOptions: L,
|
|
975
967
|
findBestErrorEnabled: !!u
|
|
976
968
|
});
|
|
977
|
-
const
|
|
978
|
-
|
|
969
|
+
const S = h <= 1 ? null : new Ze(h);
|
|
970
|
+
vt(r, t.startMemory);
|
|
979
971
|
const I = {
|
|
980
|
-
options:
|
|
972
|
+
options: o,
|
|
981
973
|
testRun: e,
|
|
982
974
|
variantsIterator: n,
|
|
983
975
|
testOptions: L,
|
|
984
976
|
testOptionsParallel: g,
|
|
985
977
|
abortControllerGlobal: y,
|
|
986
978
|
abortControllerParallel: p,
|
|
987
|
-
abortSignal:
|
|
988
|
-
pool:
|
|
979
|
+
abortSignal: E,
|
|
980
|
+
pool: S,
|
|
989
981
|
state: t
|
|
990
982
|
};
|
|
991
983
|
be(I);
|
|
992
984
|
try {
|
|
993
|
-
await
|
|
985
|
+
await xt(I), E.throwIfAborted();
|
|
994
986
|
} catch (P) {
|
|
995
987
|
throw y.abort(new T()), P;
|
|
996
988
|
}
|
|
997
|
-
return b.throwIfAborted(), y.abort(new T()),
|
|
989
|
+
return b.throwIfAborted(), y.abort(new T()), Et(I), await ee(1), dt(t, n, f);
|
|
998
990
|
}
|
|
999
|
-
function
|
|
991
|
+
function Lt(e) {
|
|
1000
992
|
return function(t) {
|
|
1001
|
-
return async function(
|
|
1002
|
-
const
|
|
1003
|
-
onError:
|
|
1004
|
-
log:
|
|
1005
|
-
|
|
993
|
+
return async function(o) {
|
|
994
|
+
const a = ge(o?.log), r = it(e, {
|
|
995
|
+
onError: o?.onError,
|
|
996
|
+
log: a,
|
|
997
|
+
pauseDebuggerOnError: o?.pauseDebuggerOnError
|
|
998
|
+
}), l = o?.timeController ?? Q, u = Y(), f = rt(l, u), d = o?.onModeChange;
|
|
1006
999
|
function h(p) {
|
|
1007
|
-
|
|
1000
|
+
f.pendingModeChange = p, d?.(p);
|
|
1008
1001
|
}
|
|
1009
|
-
const y =
|
|
1002
|
+
const y = ft({
|
|
1010
1003
|
argsTemplates: t,
|
|
1011
|
-
getSeed:
|
|
1012
|
-
iterationModes:
|
|
1013
|
-
equals:
|
|
1014
|
-
limitArgOnError:
|
|
1015
|
-
includeErrorVariant:
|
|
1016
|
-
timeController:
|
|
1004
|
+
getSeed: o?.getSeed,
|
|
1005
|
+
iterationModes: o?.iterationModes,
|
|
1006
|
+
equals: o?.findBestError?.equals,
|
|
1007
|
+
limitArgOnError: o?.findBestError?.limitArgOnError,
|
|
1008
|
+
includeErrorVariant: o?.findBestError?.includeErrorVariant,
|
|
1009
|
+
timeController: l,
|
|
1017
1010
|
onModeChange: h,
|
|
1018
|
-
limitCompletionCount:
|
|
1019
|
-
limitTests:
|
|
1020
|
-
limitTime:
|
|
1011
|
+
limitCompletionCount: o?.cycles ?? 1,
|
|
1012
|
+
limitTests: o?.limitTests,
|
|
1013
|
+
limitTime: o?.limitTime
|
|
1021
1014
|
});
|
|
1022
|
-
return
|
|
1015
|
+
return Mt(r, y, f, o);
|
|
1023
1016
|
};
|
|
1024
1017
|
};
|
|
1025
1018
|
}
|
|
1026
1019
|
export {
|
|
1027
|
-
|
|
1020
|
+
Lt as c
|
|
1028
1021
|
};
|