@flemist/test-variants 5.0.14 → 5.0.16

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