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