@flemist/test-variants 5.0.14 → 5.0.15

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