@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.
- package/README.md +7 -3
- package/build/browser/index.cjs +1 -1
- package/build/browser/index.mjs +1 -1
- package/build/common/index.cjs +1 -1
- package/build/common/index.mjs +1 -1
- package/build/common/test-variants/run/createRunState.d.ts +2 -0
- package/build/common/test-variants/run/types.d.ts +6 -1
- package/build/common/test-variants/types.d.ts +3 -3
- package/build/createTestVariants-CHE7urh4.js +4 -0
- package/build/{createTestVariants-DGrAba6p.mjs → createTestVariants-o9_knZSz.mjs} +408 -401
- package/build/node/index.cjs +1 -1
- package/build/node/index.mjs +67 -59
- package/package.json +1 -1
- package/build/createTestVariants-DHZ0gEE2.js +0 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { timeControllerDefault as
|
|
2
|
-
import { formatAny as
|
|
3
|
-
import { AbortError as Qe, AbortControllerFast as
|
|
4
|
-
import { poolWait as
|
|
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
|
|
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,
|
|
23
|
+
const tt = 1e3, j = [];
|
|
24
24
|
function rt(e) {
|
|
25
|
-
return
|
|
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
|
-
|
|
29
|
+
j.push(r), j.length > tt && j.shift(), console.log(r);
|
|
30
30
|
}
|
|
31
31
|
function ot() {
|
|
32
|
-
return
|
|
32
|
+
return j.join(`
|
|
33
33
|
`);
|
|
34
34
|
}
|
|
35
35
|
globalThis.__getStressTestLogLast = ot;
|
|
36
|
-
const
|
|
36
|
+
const he = (e, r) => {
|
|
37
37
|
nt(r);
|
|
38
|
-
},
|
|
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
|
-
}),
|
|
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:
|
|
53
|
-
format:
|
|
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:
|
|
62
|
-
format:
|
|
61
|
+
func: he,
|
|
62
|
+
format: be
|
|
63
63
|
};
|
|
64
|
-
function
|
|
65
|
-
return e === !1 ? it : e === !0 || !e ?
|
|
66
|
-
start: e.start ??
|
|
67
|
-
progress: e.progress ??
|
|
68
|
-
completed: e.completed ??
|
|
69
|
-
error: e.error ??
|
|
70
|
-
modeChange: e.modeChange ??
|
|
71
|
-
debug: e.debug ??
|
|
72
|
-
func: e.func ??
|
|
73
|
-
format: e.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
|
|
94
|
+
class C extends Qe {
|
|
94
95
|
}
|
|
95
|
-
class
|
|
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 ??
|
|
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
|
|
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
|
|
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
|
|
133
|
-
function
|
|
134
|
-
|
|
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(
|
|
137
|
-
tests: ${
|
|
138
|
-
${t.format(
|
|
137
|
+
`[test-variants] error variant: ${t.format(b)}
|
|
138
|
+
tests: ${f}
|
|
139
|
+
${t.format(y)}`
|
|
139
140
|
));
|
|
140
|
-
const
|
|
141
|
+
const h = Date.now();
|
|
141
142
|
if (i)
|
|
142
143
|
debugger;
|
|
143
|
-
if (Date.now() -
|
|
144
|
+
if (Date.now() - h > lt && u < ut) {
|
|
144
145
|
t.func(
|
|
145
146
|
"debug",
|
|
146
|
-
`[test-variants] debug iteration: ${
|
|
147
|
-
),
|
|
147
|
+
`[test-variants] debug iteration: ${u}`
|
|
148
|
+
), u++;
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
150
|
-
const
|
|
151
|
-
throw
|
|
151
|
+
const E = l;
|
|
152
|
+
throw l = null, r.onError && r.onError(E), E.error;
|
|
152
153
|
}
|
|
153
|
-
const
|
|
154
|
-
return function(
|
|
155
|
-
o && o({ args:
|
|
156
|
-
const
|
|
157
|
-
let
|
|
158
|
-
|
|
159
|
-
abortSignal:
|
|
160
|
-
|
|
161
|
-
|
|
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:
|
|
164
|
+
timeController: h.timeController
|
|
164
165
|
});
|
|
165
|
-
function
|
|
166
|
-
|
|
166
|
+
function T() {
|
|
167
|
+
x.abort(
|
|
167
168
|
new et(
|
|
168
|
-
`[test-variants] test timeout ${
|
|
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
|
|
174
|
-
if (O(
|
|
175
|
-
let
|
|
176
|
-
return
|
|
177
|
-
Date.now() -
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
Xe(
|
|
181
|
-
])),
|
|
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
|
-
|
|
184
|
-
const
|
|
185
|
-
return s && s({ args:
|
|
188
|
+
_?.(), M();
|
|
189
|
+
const D = ce(A, !0);
|
|
190
|
+
return s && s({ args: b, tests: f, result: D }), D;
|
|
186
191
|
},
|
|
187
|
-
(A) => (
|
|
192
|
+
(A) => (_?.(), M(), s && !(A instanceof C) && s({ args: b, tests: f, error: A }), m(A, b, f))
|
|
188
193
|
);
|
|
189
194
|
}
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
return s && s({ args:
|
|
193
|
-
} catch (
|
|
194
|
-
return
|
|
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
|
|
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
|
|
205
|
-
const o = Object.keys(e.templates), s = {}, n = [],
|
|
206
|
-
for (let
|
|
207
|
-
const
|
|
208
|
-
s[
|
|
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:
|
|
215
|
-
argLimits:
|
|
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
|
|
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
|
|
231
|
-
const
|
|
232
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
279
|
-
(
|
|
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
|
|
288
|
+
const u = V(
|
|
284
289
|
e,
|
|
285
290
|
n,
|
|
286
291
|
n > o
|
|
287
292
|
);
|
|
288
|
-
if (
|
|
293
|
+
if (u < 0) {
|
|
289
294
|
t = !1, e.indexes[n] = -1;
|
|
290
295
|
break;
|
|
291
296
|
}
|
|
292
|
-
|
|
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
|
|
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
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
304
|
-
e.indexes[n] =
|
|
305
|
-
for (let
|
|
306
|
-
e.args[e.argsNames[
|
|
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] =
|
|
313
|
+
e.argValues[n] = $(
|
|
309
314
|
e,
|
|
310
315
|
e.argsNames[n]
|
|
311
316
|
);
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
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],
|
|
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) ? (
|
|
323
|
+
return L(e) ? (P(e), !1) : !0;
|
|
319
324
|
}
|
|
320
325
|
}
|
|
321
|
-
return
|
|
326
|
+
return P(e), !1;
|
|
322
327
|
}
|
|
323
|
-
function
|
|
324
|
-
L(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
|
|
330
|
-
(
|
|
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
|
|
339
|
+
const u = V(
|
|
335
340
|
e,
|
|
336
341
|
n,
|
|
337
342
|
n > o
|
|
338
343
|
);
|
|
339
|
-
if (
|
|
344
|
+
if (u < 0) {
|
|
340
345
|
t = !1, e.indexes[n] = -1;
|
|
341
346
|
break;
|
|
342
347
|
}
|
|
343
|
-
|
|
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
|
|
351
|
-
const
|
|
352
|
-
let
|
|
353
|
-
if (
|
|
354
|
-
e.indexes[n] =
|
|
355
|
-
for (let
|
|
356
|
-
e.args[e.argsNames[
|
|
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] =
|
|
363
|
+
e.argValues[n] = $(
|
|
359
364
|
e,
|
|
360
365
|
e.argsNames[n]
|
|
361
366
|
);
|
|
362
|
-
const
|
|
363
|
-
if (
|
|
367
|
+
const d = V(e, n, l);
|
|
368
|
+
if (d < 0)
|
|
364
369
|
break;
|
|
365
|
-
e.indexes[n] =
|
|
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
|
|
376
|
+
return P(e), !1;
|
|
372
377
|
}
|
|
373
378
|
function mt(e, r) {
|
|
374
|
-
|
|
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],
|
|
379
|
-
if (
|
|
383
|
+
const n = t[s], l = r[n];
|
|
384
|
+
if (l === void 0)
|
|
380
385
|
return null;
|
|
381
|
-
e.argValues[s] =
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
386
|
+
e.argValues[s] = $(e, n);
|
|
387
|
+
const u = V(e, s, o);
|
|
388
|
+
if (u < 0)
|
|
384
389
|
return null;
|
|
385
|
-
const
|
|
390
|
+
const m = F(
|
|
386
391
|
e.argValues[s],
|
|
387
|
-
|
|
392
|
+
l,
|
|
388
393
|
e.equals
|
|
389
394
|
);
|
|
390
|
-
if (
|
|
395
|
+
if (m < 0 || m > u)
|
|
391
396
|
return null;
|
|
392
|
-
e.indexes[s] =
|
|
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] =
|
|
403
|
-
const o =
|
|
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 ?
|
|
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) ?
|
|
413
|
+
return L(e) ? ee(e) : !0;
|
|
409
414
|
}
|
|
410
|
-
function
|
|
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 (
|
|
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
|
-
|
|
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
|
|
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:
|
|
456
|
-
limitCompletionCount:
|
|
457
|
-
limitTests:
|
|
458
|
-
limitTime:
|
|
459
|
-
} = e,
|
|
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
|
-
},
|
|
463
|
-
let
|
|
464
|
-
function
|
|
465
|
-
|
|
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
|
|
468
|
-
for (let
|
|
469
|
-
|
|
472
|
+
function U() {
|
|
473
|
+
for (let a = 0, c = f.length; a < c; a++)
|
|
474
|
+
h.push(_());
|
|
470
475
|
}
|
|
471
|
-
function
|
|
476
|
+
function _() {
|
|
472
477
|
return {
|
|
473
|
-
navigationState:
|
|
474
|
-
|
|
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
|
|
487
|
-
|
|
488
|
-
|
|
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
|
|
496
|
-
|
|
497
|
-
mode:
|
|
498
|
-
modeIndex:
|
|
499
|
-
tests:
|
|
500
|
+
function D() {
|
|
501
|
+
l?.({
|
|
502
|
+
mode: f[g],
|
|
503
|
+
modeIndex: g,
|
|
504
|
+
tests: x
|
|
500
505
|
});
|
|
501
506
|
}
|
|
502
|
-
function Te(
|
|
503
|
-
|
|
507
|
+
function Te(a) {
|
|
508
|
+
v(), me(b.templates, a) && pt(b, a, t);
|
|
504
509
|
}
|
|
505
|
-
function
|
|
506
|
-
return
|
|
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(
|
|
509
|
-
const
|
|
510
|
-
if (
|
|
513
|
+
function Me(a) {
|
|
514
|
+
const c = a?.args;
|
|
515
|
+
if (c == null)
|
|
511
516
|
return;
|
|
512
|
-
|
|
513
|
-
const p =
|
|
517
|
+
v();
|
|
518
|
+
const p = ae(c);
|
|
514
519
|
if (p != null) {
|
|
515
|
-
|
|
516
|
-
args:
|
|
517
|
-
error:
|
|
518
|
-
tests:
|
|
519
|
-
},
|
|
520
|
-
for (let w = 0,
|
|
521
|
-
const
|
|
522
|
-
|
|
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
|
|
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
|
|
535
|
-
if (
|
|
536
|
-
return
|
|
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
|
-
|
|
545
|
+
Ge();
|
|
541
546
|
break;
|
|
542
547
|
}
|
|
543
548
|
}
|
|
544
549
|
}
|
|
545
550
|
}
|
|
546
551
|
function Ce() {
|
|
547
|
-
return !(Ae() || Oe() ||
|
|
552
|
+
return !(Ae() || Oe() || B() && (Le() || !_e()) || !Ne());
|
|
548
553
|
}
|
|
549
554
|
function Ae() {
|
|
550
|
-
return
|
|
555
|
+
return m != null && x >= m;
|
|
551
556
|
}
|
|
552
557
|
function Oe() {
|
|
553
|
-
return
|
|
558
|
+
return d != null && y.now() - M >= d;
|
|
554
559
|
}
|
|
555
560
|
function Le() {
|
|
556
|
-
if (!
|
|
561
|
+
if (!B())
|
|
557
562
|
throw new Error("Unexpected behavior");
|
|
558
|
-
return
|
|
563
|
+
return u != null && u <= 0;
|
|
559
564
|
}
|
|
560
565
|
function _e() {
|
|
561
|
-
if (!
|
|
566
|
+
if (!B())
|
|
562
567
|
throw new Error("Unexpected behavior");
|
|
563
|
-
for (let
|
|
564
|
-
if (
|
|
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
|
|
570
|
-
if (
|
|
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
|
-
|
|
576
|
-
const
|
|
577
|
-
return
|
|
580
|
+
g++;
|
|
581
|
+
const a = g >= f.length;
|
|
582
|
+
return a && (g = 0), D(), a;
|
|
578
583
|
}
|
|
579
584
|
function $e() {
|
|
580
|
-
if (
|
|
581
|
-
const
|
|
582
|
-
if (
|
|
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
|
|
588
|
-
for (let
|
|
589
|
-
if (
|
|
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
|
|
594
|
-
let
|
|
595
|
-
for (let p = 0, w =
|
|
596
|
-
const
|
|
597
|
-
|
|
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 (!
|
|
604
|
+
if (!a)
|
|
600
605
|
throw new Error("Unexpected behavior");
|
|
601
|
-
return
|
|
606
|
+
return c;
|
|
602
607
|
}
|
|
603
|
-
function
|
|
604
|
-
const
|
|
605
|
-
return
|
|
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
|
|
608
|
-
|
|
609
|
-
for (let
|
|
610
|
-
const p =
|
|
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
|
|
616
|
-
for (;
|
|
620
|
+
let a = 0;
|
|
621
|
+
for (; a < 2; ) {
|
|
617
622
|
if (!Ue())
|
|
618
623
|
return null;
|
|
619
|
-
const
|
|
620
|
-
if (
|
|
621
|
-
return
|
|
622
|
-
if (
|
|
624
|
+
const c = Fe();
|
|
625
|
+
if (c != null)
|
|
626
|
+
return c;
|
|
627
|
+
if (N(f[g]) && je())
|
|
623
628
|
return null;
|
|
624
|
-
|
|
629
|
+
a++;
|
|
625
630
|
}
|
|
626
631
|
return null;
|
|
627
632
|
}
|
|
628
633
|
function Ue() {
|
|
629
|
-
const
|
|
630
|
-
return !(Be() || ke() ||
|
|
634
|
+
const a = f[g];
|
|
635
|
+
return !(Be() || ke() || N(a) && !Re(g));
|
|
631
636
|
}
|
|
632
637
|
function Be() {
|
|
633
|
-
const
|
|
634
|
-
return
|
|
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
|
|
638
|
-
return
|
|
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
|
|
641
|
-
return
|
|
645
|
+
function N(a) {
|
|
646
|
+
return R(a);
|
|
642
647
|
}
|
|
643
|
-
function Re(
|
|
644
|
-
const
|
|
645
|
-
if (!
|
|
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 < (
|
|
652
|
+
return p.cycleCount < (c.cycles ?? 1);
|
|
648
653
|
}
|
|
649
654
|
function je() {
|
|
650
|
-
const
|
|
651
|
-
if (!
|
|
655
|
+
const a = f[g], c = h[g];
|
|
656
|
+
if (!N(a))
|
|
652
657
|
throw new Error("Unexpected behavior");
|
|
653
|
-
return
|
|
658
|
+
return c.cycleCount++, c.cycleCount >= (a.cycles ?? 1) ? (c.cycleCount = 0, c.completedCount++, !0) : !1;
|
|
654
659
|
}
|
|
655
660
|
function Fe() {
|
|
656
|
-
const
|
|
657
|
-
if (
|
|
658
|
-
if (
|
|
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
|
|
667
|
+
return c.startTime == null && (c.startTime = y.now()), w;
|
|
663
668
|
}
|
|
664
|
-
return He() ? (
|
|
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
|
|
668
|
-
if (
|
|
672
|
+
const a = f[g], p = h[g].navigationState;
|
|
673
|
+
if (!G(a))
|
|
669
674
|
throw new Error("Unexpected behavior");
|
|
670
|
-
if (
|
|
675
|
+
if (X())
|
|
671
676
|
throw new Error("Unexpected behavior");
|
|
672
|
-
const w =
|
|
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
|
|
677
|
-
if (
|
|
681
|
+
const a = f[g], p = h[g].navigationState;
|
|
682
|
+
if (!G(a))
|
|
678
683
|
throw new Error("Unexpected behavior");
|
|
679
|
-
if (
|
|
684
|
+
if (X())
|
|
680
685
|
throw new Error("Unexpected behavior");
|
|
681
686
|
p.attempts = 1;
|
|
682
687
|
}
|
|
683
|
-
function
|
|
684
|
-
return
|
|
688
|
+
function G(a) {
|
|
689
|
+
return R(a);
|
|
685
690
|
}
|
|
686
|
-
function
|
|
687
|
-
const
|
|
688
|
-
if (
|
|
691
|
+
function X() {
|
|
692
|
+
const a = f[g];
|
|
693
|
+
if (!G(a))
|
|
689
694
|
throw new Error("Unexpected behavior");
|
|
690
|
-
return (
|
|
695
|
+
return (a.attemptsPerVariant ?? 1) <= 0;
|
|
691
696
|
}
|
|
692
697
|
function He() {
|
|
693
|
-
const
|
|
694
|
-
switch (
|
|
698
|
+
const a = f[g], p = h[g].navigationState;
|
|
699
|
+
switch (a.mode) {
|
|
695
700
|
case "forward":
|
|
696
|
-
return
|
|
701
|
+
return ve(p);
|
|
697
702
|
case "backward":
|
|
698
|
-
return
|
|
703
|
+
return ee(p);
|
|
699
704
|
case "random":
|
|
700
705
|
return dt(p);
|
|
701
706
|
default:
|
|
702
|
-
throw new Error(`Unknown mode: ${
|
|
707
|
+
throw new Error(`Unknown mode: ${a.mode}`);
|
|
703
708
|
}
|
|
704
709
|
}
|
|
705
|
-
function le(
|
|
706
|
-
const
|
|
707
|
-
return s != null && (
|
|
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
|
|
716
|
+
return E;
|
|
712
717
|
},
|
|
713
718
|
get modeIndex() {
|
|
714
|
-
return
|
|
719
|
+
return g;
|
|
715
720
|
},
|
|
716
721
|
get modeConfigs() {
|
|
717
|
-
return
|
|
722
|
+
return f;
|
|
718
723
|
},
|
|
719
724
|
get modeStates() {
|
|
720
|
-
return
|
|
725
|
+
return h;
|
|
721
726
|
},
|
|
722
727
|
get tests() {
|
|
723
|
-
return
|
|
728
|
+
return x;
|
|
724
729
|
},
|
|
725
|
-
calcIndexes:
|
|
730
|
+
calcIndexes: ae,
|
|
726
731
|
extendTemplates: Te,
|
|
727
732
|
addLimit: Me,
|
|
728
733
|
next: Ie
|
|
729
734
|
};
|
|
730
735
|
}
|
|
731
|
-
function
|
|
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(
|
|
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
|
|
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 ?
|
|
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 =
|
|
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
|
|
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:
|
|
783
|
+
logOptions: ye(e?.log),
|
|
779
784
|
abortSignalExternal: e?.abortSignal,
|
|
780
785
|
findBestError: i,
|
|
781
786
|
dontThrowIfError: i?.dontThrowIfError,
|
|
782
|
-
timeController: e?.timeController ??
|
|
787
|
+
timeController: e?.timeController ?? H,
|
|
783
788
|
parallel: o,
|
|
784
789
|
sequentialOnError: s
|
|
785
790
|
};
|
|
786
791
|
}
|
|
787
|
-
function
|
|
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
|
|
796
|
-
const { abortControllerParallel: o, state: s, options: n } = e, { logOptions:
|
|
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,
|
|
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
|
|
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
|
-
|
|
813
|
+
W(e, r, !1), o.abort(t);
|
|
809
814
|
}
|
|
810
815
|
}
|
|
811
|
-
function
|
|
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 =
|
|
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 =
|
|
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
|
|
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
|
|
835
|
-
e.prevGcIterations = e.iterations, e.prevGcIterationsAsync = e.iterationsAsync, e.prevGcTime = r, await
|
|
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
|
|
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
|
|
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=${
|
|
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
|
|
862
|
+
function xe(e, r) {
|
|
858
863
|
const t = e - r, i = t >= 0 ? "+" : "";
|
|
859
|
-
return `${
|
|
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: ${
|
|
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} (${
|
|
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
|
|
875
|
-
|
|
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
|
|
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
|
|
895
|
-
|
|
899
|
+
const u = ie();
|
|
900
|
+
u != null && (l += `, memory: ${xe(u, t.prevLogMemory)}`, t.prevLogMemory = u);
|
|
896
901
|
}
|
|
897
|
-
return i.func("progress",
|
|
902
|
+
return i.func("progress", l), t.prevLogTime = s, !0;
|
|
898
903
|
}
|
|
899
|
-
function
|
|
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
|
|
903
|
-
e.state.debugMode = !0, e.abortControllerParallel.abort(new
|
|
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
|
-
(
|
|
913
|
-
if (!
|
|
914
|
-
|
|
917
|
+
(l) => {
|
|
918
|
+
if (!l) {
|
|
919
|
+
ne(e);
|
|
915
920
|
return;
|
|
916
921
|
}
|
|
917
|
-
|
|
922
|
+
re(o, l);
|
|
918
923
|
},
|
|
919
|
-
(
|
|
924
|
+
(l) => ge(e, r, l, s)
|
|
920
925
|
);
|
|
921
926
|
if (!n) {
|
|
922
|
-
|
|
927
|
+
ne(e);
|
|
923
928
|
return;
|
|
924
929
|
}
|
|
925
|
-
|
|
930
|
+
re(o, n);
|
|
926
931
|
} catch (n) {
|
|
927
|
-
return n instanceof
|
|
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
|
|
939
|
+
const l = n.tests;
|
|
935
940
|
n.tests++, (async () => {
|
|
936
941
|
try {
|
|
937
942
|
if (i.aborted)
|
|
938
943
|
return;
|
|
939
|
-
let
|
|
940
|
-
if (O(
|
|
941
|
-
|
|
944
|
+
let u = o(r, l, s);
|
|
945
|
+
if (O(u) && (u = await u), !u) {
|
|
946
|
+
ne(e);
|
|
942
947
|
return;
|
|
943
948
|
}
|
|
944
|
-
|
|
945
|
-
} catch (
|
|
946
|
-
if (
|
|
949
|
+
re(n, u);
|
|
950
|
+
} catch (u) {
|
|
951
|
+
if (u instanceof C)
|
|
947
952
|
return;
|
|
948
|
-
|
|
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 (
|
|
961
|
-
return
|
|
965
|
+
if (Et(e, n))
|
|
966
|
+
return wt(t, n);
|
|
962
967
|
}
|
|
963
|
-
function
|
|
968
|
+
function z(e) {
|
|
964
969
|
return e.options.abortSignalExternal?.aborted ?? !1;
|
|
965
970
|
}
|
|
966
|
-
function
|
|
971
|
+
function oe(e) {
|
|
967
972
|
return e.abortSignal.aborted;
|
|
968
973
|
}
|
|
969
|
-
async function
|
|
974
|
+
async function K(e, r) {
|
|
970
975
|
const { pool: t, state: i, options: o } = e, { parallel: s, logOptions: n } = o;
|
|
971
|
-
let
|
|
972
|
-
for (; !
|
|
973
|
-
const
|
|
974
|
-
let
|
|
975
|
-
|
|
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 ? (
|
|
982
|
+
if (r != null ? (l = r, r = null) : e.state.debugMode || (l = e.variantsIterator.next()), l == null)
|
|
978
983
|
break;
|
|
979
|
-
const
|
|
980
|
-
if (O(
|
|
984
|
+
const d = we(e);
|
|
985
|
+
if (O(d) && await d, z(e))
|
|
981
986
|
continue;
|
|
982
|
-
if (
|
|
983
|
-
Ct(e,
|
|
987
|
+
if (u)
|
|
988
|
+
Ct(e, l), m = !1;
|
|
984
989
|
else {
|
|
985
|
-
n.debug && t &&
|
|
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
|
|
990
|
-
O(
|
|
994
|
+
const y = Ee(e, l);
|
|
995
|
+
O(y) && await y;
|
|
991
996
|
}
|
|
992
997
|
} finally {
|
|
993
|
-
|
|
998
|
+
m && t.release(1);
|
|
994
999
|
}
|
|
995
1000
|
}
|
|
996
|
-
t && (await
|
|
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
|
|
1006
|
+
return K(e);
|
|
1002
1007
|
let s = null;
|
|
1003
|
-
for (; !
|
|
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(() =>
|
|
1007
|
-
if (
|
|
1011
|
+
return n.then(() => K(e, s));
|
|
1012
|
+
if (z(e))
|
|
1008
1013
|
continue;
|
|
1009
|
-
o.debug &&
|
|
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
|
|
1014
|
-
if (O(
|
|
1015
|
-
return
|
|
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 =
|
|
1024
|
+
const o = xt(i), {
|
|
1020
1025
|
store: s,
|
|
1021
1026
|
logOptions: n,
|
|
1022
|
-
abortSignalExternal:
|
|
1023
|
-
findBestError:
|
|
1024
|
-
dontThrowIfError:
|
|
1025
|
-
timeController:
|
|
1026
|
-
parallel:
|
|
1027
|
-
} = o,
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
),
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
),
|
|
1034
|
-
abortSignal:
|
|
1035
|
-
timeController:
|
|
1036
|
-
},
|
|
1037
|
-
abortSignal:
|
|
1038
|
-
timeController:
|
|
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:
|
|
1044
|
-
findBestErrorEnabled: !!
|
|
1048
|
+
testOptions: E,
|
|
1049
|
+
findBestErrorEnabled: !!u,
|
|
1050
|
+
state: t
|
|
1045
1051
|
});
|
|
1046
|
-
const
|
|
1052
|
+
const x = y <= 1 ? null : new Ye(y);
|
|
1047
1053
|
Mt(n, t.startMemory);
|
|
1048
|
-
const
|
|
1054
|
+
const T = {
|
|
1049
1055
|
options: o,
|
|
1050
1056
|
testRun: e,
|
|
1051
1057
|
variantsIterator: r,
|
|
1052
|
-
testOptions:
|
|
1053
|
-
testOptionsParallel:
|
|
1054
|
-
abortControllerGlobal:
|
|
1055
|
-
abortControllerParallel:
|
|
1056
|
-
abortSignal:
|
|
1057
|
-
pool:
|
|
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(
|
|
1066
|
+
Se(T);
|
|
1061
1067
|
try {
|
|
1062
|
-
await At(
|
|
1063
|
-
} catch (
|
|
1064
|
-
throw
|
|
1068
|
+
await At(T), S.throwIfAborted();
|
|
1069
|
+
} catch (M) {
|
|
1070
|
+
throw b.abort(new C()), M;
|
|
1065
1071
|
}
|
|
1066
|
-
return
|
|
1072
|
+
return h.throwIfAborted(), b.abort(new C()), It(T), await se(1), yt(t, r, m);
|
|
1067
1073
|
}
|
|
1068
|
-
function
|
|
1074
|
+
function Dt(e) {
|
|
1069
1075
|
return function(t) {
|
|
1070
1076
|
return async function(o) {
|
|
1071
|
-
const s =
|
|
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
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
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
|
|
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:
|
|
1090
|
-
onModeChange:
|
|
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(
|
|
1102
|
+
return Ot(m, b, u, o);
|
|
1096
1103
|
};
|
|
1097
1104
|
};
|
|
1098
1105
|
}
|
|
1099
1106
|
export {
|
|
1100
1107
|
et as T,
|
|
1101
|
-
|
|
1108
|
+
Dt as c
|
|
1102
1109
|
};
|