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