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