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