sedum-cli 0.1.0-alpha.22 → 0.1.0-alpha.23
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/dist/{affected-selection-7XPP7NKZ.js → affected-selection-ON2NPZTN.js} +166 -78
- package/dist/{chunk-7RXHCQFR.js → chunk-55HRCJCM.js} +21 -19
- package/dist/{chunk-FOGLJA3Z.js → chunk-5P4FY5IO.js} +2 -2
- package/dist/{chunk-NIUOM3FA.js → chunk-A2CNICAJ.js} +4 -1
- package/dist/{chunk-J7CLCLHW.js → chunk-KISBU2JR.js} +63 -31
- package/dist/{chunk-DXNJ3PGB.js → chunk-LQM3ZUCR.js} +2 -2
- package/dist/{chunk-CGDXQY2Y.js → chunk-NQY7NBC7.js} +1 -1
- package/dist/{chunk-QVCT63FH.js → chunk-PMBUVQVS.js} +1 -1
- package/dist/cli.js +4 -4
- package/dist/{cloud-upload-IGNNU5WX.js → cloud-upload-TDT3GOTX.js} +2 -2
- package/dist/{doctor-command-OFMURNPN.js → doctor-command-5YAF7YLZ.js} +3 -3
- package/dist/{explore-command-KMS6UAPM.js → explore-command-NXA36QIC.js} +3 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -4
- package/dist/{init-command-IXR3YUQW.js → init-command-BLXSCSFU.js} +3 -3
- package/dist/{run-command-6UTIJAHU.js → run-command-CDEIBWVB.js} +12 -6
- package/package.json +5 -5
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
discoverRunTests
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PMBUVQVS.js";
|
|
4
4
|
import {
|
|
5
5
|
createCliProvider
|
|
6
6
|
} from "./chunk-N5CTUO2A.js";
|
|
7
7
|
import {
|
|
8
8
|
providerDiagnostic
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NQY7NBC7.js";
|
|
10
10
|
import {
|
|
11
11
|
AffectedSelectionError,
|
|
12
|
+
GitInputTooLarge,
|
|
12
13
|
MAX_DIFF_BYTES,
|
|
13
14
|
gitRead
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-A2CNICAJ.js";
|
|
15
16
|
import {
|
|
16
17
|
affectedPathIgnored,
|
|
17
18
|
loadProjectConfig,
|
|
19
|
+
runAllChange,
|
|
18
20
|
validAffectedGlob
|
|
19
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KISBU2JR.js";
|
|
20
22
|
|
|
21
23
|
// src/affected-selection.ts
|
|
22
24
|
import { realpath } from "fs/promises";
|
|
@@ -25,6 +27,7 @@ import {
|
|
|
25
27
|
isScriptTestFile,
|
|
26
28
|
loadFlowFile,
|
|
27
29
|
ProviderError,
|
|
30
|
+
RELEVANCE_CONCURRENCY,
|
|
28
31
|
resolveFlowModules
|
|
29
32
|
} from "@sedum-dev/core";
|
|
30
33
|
|
|
@@ -179,15 +182,17 @@ async function readRetainedPatches({ root, head, signal }, mergeBase, files) {
|
|
|
179
182
|
],
|
|
180
183
|
signal,
|
|
181
184
|
MAX_DIFF_BYTES - bytes
|
|
182
|
-
)
|
|
185
|
+
).catch((error) => {
|
|
186
|
+
if (error instanceof GitInputTooLarge) return null;
|
|
187
|
+
throw error;
|
|
188
|
+
});
|
|
189
|
+
if (patch === null) return { skipped: "the diff is over the 16 MiB guard" };
|
|
183
190
|
if (/^Binary files .* differ$/mu.test(patch) || /^[+ -]Subproject commit /mu.test(patch))
|
|
184
|
-
|
|
185
|
-
"Binary or submodule changes cannot be scored reliably. Run the full suite without --affected."
|
|
186
|
-
);
|
|
191
|
+
return { skipped: "binary or submodule changes cannot be scored" };
|
|
187
192
|
bytes += Buffer.byteLength(patch);
|
|
188
193
|
patches.push(patch);
|
|
189
194
|
}
|
|
190
|
-
return patches.join("");
|
|
195
|
+
return { diff: patches.join("") };
|
|
191
196
|
}
|
|
192
197
|
function assertValidIgnores(ignore) {
|
|
193
198
|
if (ignore.some((pattern) => !validAffectedGlob(pattern)))
|
|
@@ -209,11 +214,12 @@ async function readBranchDiff(cwd, base, signal, ignore = []) {
|
|
|
209
214
|
const ignoredFiles = changed.filter(
|
|
210
215
|
(file) => affectedPathIgnored(file, ignore)
|
|
211
216
|
);
|
|
212
|
-
const
|
|
217
|
+
const patches = await readRetainedPatches(
|
|
213
218
|
snapshot,
|
|
214
219
|
mergeBase,
|
|
215
220
|
changed.filter((file) => !affectedPathIgnored(file, ignore))
|
|
216
221
|
);
|
|
222
|
+
const diff = "diff" in patches ? patches.diff : "";
|
|
217
223
|
await assertAffectedSnapshot(snapshot);
|
|
218
224
|
return {
|
|
219
225
|
root,
|
|
@@ -222,7 +228,8 @@ async function readBranchDiff(cwd, base, signal, ignore = []) {
|
|
|
222
228
|
mergeBase,
|
|
223
229
|
diff,
|
|
224
230
|
changed,
|
|
225
|
-
ignoredFiles
|
|
231
|
+
ignoredFiles,
|
|
232
|
+
..."skipped" in patches ? { skipped: patches.skipped } : {}
|
|
226
233
|
};
|
|
227
234
|
} catch (error) {
|
|
228
235
|
rethrowGitError(
|
|
@@ -250,7 +257,49 @@ async function selectAffectedTests(options) {
|
|
|
250
257
|
head: branch.head,
|
|
251
258
|
signal: options.signal
|
|
252
259
|
};
|
|
253
|
-
const
|
|
260
|
+
const { tests, forced } = await readCandidates(
|
|
261
|
+
await discoverCandidates(config, options),
|
|
262
|
+
branch,
|
|
263
|
+
{
|
|
264
|
+
projectRoot: config.projectRoot,
|
|
265
|
+
canonicalProjectRoot,
|
|
266
|
+
source: async (file) => readCommittedSource(snapshot, await realpath(file))
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
options.signal?.throwIfAborted();
|
|
270
|
+
await assertAffectedSnapshot(snapshot);
|
|
271
|
+
const candidates = tests.filter((_, index) => !forced[index]);
|
|
272
|
+
const runAll = runAllChange(
|
|
273
|
+
branch.changed.filter((file) => !branch.ignoredFiles.includes(file)),
|
|
274
|
+
posixRelative(branch.root, canonicalProjectRoot),
|
|
275
|
+
config.configPath && posixRelative(branch.root, await realpath(config.configPath))
|
|
276
|
+
);
|
|
277
|
+
const scores = branch.diff && candidates.length && !runAll && !branch.skipped ? await scoreCandidates(config, branch.diff, candidates, options) : { probabilities: candidates.map(() => 0), calls: [], chunkCount: 0 };
|
|
278
|
+
const skipped = branch.skipped ?? scores.skipped;
|
|
279
|
+
return {
|
|
280
|
+
base: branch.base,
|
|
281
|
+
head: branch.head,
|
|
282
|
+
mergeBase: branch.mergeBase,
|
|
283
|
+
changedFiles: branch.changed,
|
|
284
|
+
ignoredFiles: branch.ignoredFiles,
|
|
285
|
+
chunkCount: scores.chunkCount ?? (scores.calls.length ? 1 : 0),
|
|
286
|
+
aggregation: "max",
|
|
287
|
+
threshold: options.threshold,
|
|
288
|
+
calls: scores.calls,
|
|
289
|
+
// Undefined fields are left out of the JSON.
|
|
290
|
+
runAllFile: runAll,
|
|
291
|
+
skipped,
|
|
292
|
+
failure: scores.failure,
|
|
293
|
+
tests: decideTests(tests, forced, scores, {
|
|
294
|
+
diff: branch.diff,
|
|
295
|
+
ignored: branch.ignoredFiles.length > 0,
|
|
296
|
+
threshold: options.threshold,
|
|
297
|
+
runAll: runAll !== void 0,
|
|
298
|
+
skipped: skipped !== void 0
|
|
299
|
+
})
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
async function discoverCandidates(config, options) {
|
|
254
303
|
const selection = await discoverRunTests(
|
|
255
304
|
config,
|
|
256
305
|
options.paths,
|
|
@@ -260,6 +309,9 @@ async function selectAffectedTests(options) {
|
|
|
260
309
|
throw new AffectedSelectionError(
|
|
261
310
|
"Test discovery is empty or invalid. Run sedum validate and fix discovery before using --affected."
|
|
262
311
|
);
|
|
312
|
+
return [...new Set(selection.tests.map((test) => test.file))];
|
|
313
|
+
}
|
|
314
|
+
async function readCandidates(files, branch, reading) {
|
|
263
315
|
const changed = new Set(
|
|
264
316
|
branch.changed.map((file) => path2.resolve(branch.root, file))
|
|
265
317
|
);
|
|
@@ -267,87 +319,94 @@ async function selectAffectedTests(options) {
|
|
|
267
319
|
changed.add(await realpath(file).catch(() => file));
|
|
268
320
|
const tests = [];
|
|
269
321
|
const forced = [];
|
|
270
|
-
for (const
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
322
|
+
for (const file of files) {
|
|
323
|
+
const candidate = await readCandidate(file, { ...reading, changed });
|
|
324
|
+
tests.push(candidate.test);
|
|
325
|
+
forced.push(candidate.forced);
|
|
326
|
+
}
|
|
327
|
+
return { tests, forced };
|
|
328
|
+
}
|
|
329
|
+
async function readCandidate(name, reading) {
|
|
330
|
+
const file = path2.join(reading.projectRoot, name);
|
|
331
|
+
const canonical = await realpath(file);
|
|
332
|
+
if (isScriptTestFile(file))
|
|
333
|
+
return {
|
|
334
|
+
test: { file: name, source: await reading.source(file), modules: [] },
|
|
335
|
+
forced: reading.changed.has(canonical)
|
|
336
|
+
};
|
|
337
|
+
const parsed = await loadFlowFile(file, {
|
|
338
|
+
repoRoot: reading.projectRoot,
|
|
339
|
+
rejectSymlinks: true
|
|
340
|
+
});
|
|
341
|
+
const resolved = await resolveFlowModules(parsed, {
|
|
342
|
+
repoRoot: reading.projectRoot
|
|
343
|
+
});
|
|
344
|
+
if (!resolved.value || resolved.diagnostics.some((item) => item.severity === "error"))
|
|
345
|
+
throw new AffectedSelectionError(
|
|
346
|
+
"A test or module is invalid. Run sedum validate before using --affected."
|
|
347
|
+
);
|
|
348
|
+
return {
|
|
349
|
+
test: {
|
|
350
|
+
file: name,
|
|
351
|
+
source: await reading.source(file),
|
|
298
352
|
modules: await Promise.all(
|
|
299
353
|
resolved.moduleFiles.map(async (module) => ({
|
|
300
|
-
file:
|
|
301
|
-
source: await source(module)
|
|
354
|
+
file: posixRelative(reading.canonicalProjectRoot, module),
|
|
355
|
+
source: await reading.source(module)
|
|
302
356
|
}))
|
|
303
357
|
)
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
358
|
+
},
|
|
359
|
+
forced: [canonical, ...resolved.moduleFiles].some(
|
|
360
|
+
(source) => reading.changed.has(source)
|
|
361
|
+
)
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
async function scoreCandidates(config, diff, candidates, options) {
|
|
310
365
|
try {
|
|
311
|
-
|
|
312
|
-
|
|
366
|
+
const provider = options.createProvider ? await options.createProvider(config) : await createCliProvider(config, {
|
|
367
|
+
// A lower --provider-concurrency is a quota the user set; keep it.
|
|
368
|
+
concurrency: Math.min(
|
|
369
|
+
RELEVANCE_CONCURRENCY,
|
|
370
|
+
options.providerConcurrency ?? RELEVANCE_CONCURRENCY
|
|
371
|
+
)
|
|
372
|
+
});
|
|
373
|
+
return await provider.scoreRelevance(
|
|
374
|
+
diff,
|
|
313
375
|
candidates,
|
|
314
376
|
options.signal ? { signal: options.signal } : void 0
|
|
315
|
-
)
|
|
377
|
+
);
|
|
316
378
|
} catch (error) {
|
|
317
|
-
|
|
318
|
-
const diagnostic = providerDiagnostic(config, error.code);
|
|
319
|
-
throw new AffectedSelectionError(
|
|
320
|
-
`${diagnostic.message}
|
|
321
|
-
Fix: ${diagnostic.fix}`
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
throw error;
|
|
379
|
+
throw selectionError(config, error);
|
|
325
380
|
}
|
|
326
|
-
return {
|
|
327
|
-
base: branch.base,
|
|
328
|
-
head: branch.head,
|
|
329
|
-
mergeBase: branch.mergeBase,
|
|
330
|
-
changedFiles: branch.changed,
|
|
331
|
-
ignoredFiles: branch.ignoredFiles,
|
|
332
|
-
chunkCount: scores.chunkCount ?? (scores.calls.length ? 1 : 0),
|
|
333
|
-
aggregation: "max",
|
|
334
|
-
threshold: options.threshold,
|
|
335
|
-
calls: scores.calls,
|
|
336
|
-
tests: decideTests(tests, forced, scores, {
|
|
337
|
-
diff: branch.diff,
|
|
338
|
-
ignored: branch.ignoredFiles.length > 0,
|
|
339
|
-
threshold: options.threshold
|
|
340
|
-
})
|
|
341
|
-
};
|
|
342
381
|
}
|
|
382
|
+
var FIXABLE = /* @__PURE__ */ new Set([
|
|
383
|
+
"authentication",
|
|
384
|
+
"configuration"
|
|
385
|
+
]);
|
|
386
|
+
function fixable(error) {
|
|
387
|
+
return error instanceof ProviderError && FIXABLE.has(error.code);
|
|
388
|
+
}
|
|
389
|
+
function selectionError(config, error) {
|
|
390
|
+
if (!fixable(error)) return error;
|
|
391
|
+
const diagnostic = providerDiagnostic(config, error.code);
|
|
392
|
+
return new AffectedSelectionError(
|
|
393
|
+
`${diagnostic.message}
|
|
394
|
+
Fix: ${diagnostic.fix}`
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
var posixRelative = (from, to) => path2.relative(from, to).split(path2.sep).join("/");
|
|
343
398
|
function decideTests(tests, forced, scores, context) {
|
|
344
|
-
const
|
|
399
|
+
const unread = {
|
|
400
|
+
oversized: new Set(scores.oversized ?? []),
|
|
401
|
+
unscored: new Set(scores.unscored ?? [])
|
|
402
|
+
};
|
|
345
403
|
const fallback = context.diff ? "model" : context.ignored ? "all-ignored" : "no-diff";
|
|
346
404
|
let candidate = 0;
|
|
347
405
|
return tests.map((test, index) => {
|
|
348
406
|
if (forced[index]) return run(test, "test-or-module-changed");
|
|
349
407
|
const current = candidate++;
|
|
350
|
-
|
|
408
|
+
const reason = unscoredReason(current, context, unread);
|
|
409
|
+
if (reason) return run(test, reason);
|
|
351
410
|
const probability = scores.probabilities[current];
|
|
352
411
|
return {
|
|
353
412
|
file: test.file,
|
|
@@ -357,11 +416,40 @@ function decideTests(tests, forced, scores, context) {
|
|
|
357
416
|
};
|
|
358
417
|
});
|
|
359
418
|
}
|
|
419
|
+
function unscoredReason(current, context, unread) {
|
|
420
|
+
if (context.runAll) return "run-all-file-changed";
|
|
421
|
+
if (context.skipped) return "selection-skipped";
|
|
422
|
+
if (unread.oversized.has(current)) return "too-large-to-score";
|
|
423
|
+
if (unread.unscored.has(current)) return "scoring-failed";
|
|
424
|
+
return void 0;
|
|
425
|
+
}
|
|
360
426
|
function run(test, reason) {
|
|
361
427
|
return { file: test.file, probability: 1, selected: true, reason };
|
|
362
428
|
}
|
|
429
|
+
function selectionFallback(selection) {
|
|
430
|
+
if (selection.runAllFile)
|
|
431
|
+
return `${selection.runAllFile} changed, so every test runs without asking the model.`;
|
|
432
|
+
if (selection.skipped)
|
|
433
|
+
return `Selection skipped: ${selection.skipped}. Every test runs.`;
|
|
434
|
+
if (selection.failure)
|
|
435
|
+
return `Some relevance calls failed, so their tests run: ${selection.failure}`;
|
|
436
|
+
return void 0;
|
|
437
|
+
}
|
|
438
|
+
function selectionReport(selection) {
|
|
439
|
+
const selected = selection.tests.filter((test) => test.selected).length;
|
|
440
|
+
const fallback = selectionFallback(selection);
|
|
441
|
+
return [
|
|
442
|
+
`Affected selection: ${selected}/${selection.tests.length} tests, threshold ${selection.threshold}, base ${selection.base}.`,
|
|
443
|
+
...fallback ? [fallback] : [],
|
|
444
|
+
...selection.tests.map(
|
|
445
|
+
(test) => `${test.selected ? "RUN " : "SKIP"} ${test.probability.toFixed(4)} ${JSON.stringify(test.file)} (${test.reason})`
|
|
446
|
+
)
|
|
447
|
+
].map((line) => `${line}
|
|
448
|
+
`).join("");
|
|
449
|
+
}
|
|
363
450
|
export {
|
|
364
451
|
AffectedSelectionError,
|
|
365
452
|
readBranchDiff,
|
|
366
|
-
selectAffectedTests
|
|
453
|
+
selectAffectedTests,
|
|
454
|
+
selectionReport
|
|
367
455
|
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
seedValue,
|
|
8
8
|
startUrl,
|
|
9
9
|
watchOrigin
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5P4FY5IO.js";
|
|
11
11
|
import {
|
|
12
12
|
MAX_PARALLEL,
|
|
13
13
|
clearLocatorCache,
|
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
configDiagnostic,
|
|
21
21
|
renderDiagnostic
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-NQY7NBC7.js";
|
|
23
23
|
import {
|
|
24
24
|
ProjectConfigError,
|
|
25
25
|
discoverConfiguredTests,
|
|
26
26
|
loadProjectConfig,
|
|
27
27
|
validAffectedGlob
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-KISBU2JR.js";
|
|
29
29
|
|
|
30
30
|
// src/invocation.ts
|
|
31
31
|
function sedumCommand(env = process.env, script = process.argv[1] ?? "") {
|
|
@@ -865,7 +865,7 @@ async function runCli(args, version, runtime = {}) {
|
|
|
865
865
|
const writeOut = (value) => rawOut(withCommand(value, command));
|
|
866
866
|
const writeErr = (value) => rawErr(withCommand(value, command));
|
|
867
867
|
const capabilities = runtime.capabilities ?? plainOutput;
|
|
868
|
-
const executeRun = runtime.executeRun ?? (async (options) => (await import("./run-command-
|
|
868
|
+
const executeRun = runtime.executeRun ?? (async (options) => (await import("./run-command-CDEIBWVB.js")).executeRunCommand(options));
|
|
869
869
|
const cwd = runtime.cwd ?? process.cwd();
|
|
870
870
|
let exitCode = 3;
|
|
871
871
|
const program = createProgram(version, writeOut, writeErr);
|
|
@@ -879,7 +879,7 @@ async function runCli(args, version, runtime = {}) {
|
|
|
879
879
|
"after",
|
|
880
880
|
"\nCreates a config, a SauceDemo example, .env.example, and ignore rules.\nExisting files are never replaced.\n"
|
|
881
881
|
).action(async () => {
|
|
882
|
-
const { executeInitCommand } = await import("./init-command-
|
|
882
|
+
const { executeInitCommand } = await import("./init-command-BLXSCSFU.js");
|
|
883
883
|
const interactive = capabilities.stdoutIsTTY && (process.stdin.isTTY === true || runtime.confirmInit !== void 0);
|
|
884
884
|
const confirm = runtime.confirmInit ?? (interactive ? async (question) => {
|
|
885
885
|
const { createInterface } = await import("readline/promises");
|
|
@@ -938,8 +938,13 @@ async function runCli(args, version, runtime = {}) {
|
|
|
938
938
|
exitCode = 3;
|
|
939
939
|
return;
|
|
940
940
|
}
|
|
941
|
+
let priority = /* @__PURE__ */ new Map();
|
|
941
942
|
if (options.affected) {
|
|
942
|
-
const {
|
|
943
|
+
const {
|
|
944
|
+
selectAffectedTests,
|
|
945
|
+
selectionReport,
|
|
946
|
+
AffectedSelectionError
|
|
947
|
+
} = await import("./affected-selection-ON2NPZTN.js");
|
|
943
948
|
const { ProviderError: ProviderError2 } = await import("@sedum-dev/core");
|
|
944
949
|
writeErr(
|
|
945
950
|
"Experimental selection sends the committed Git diff and complete test/module sources to the configured provider. Tracked local edits are refused. Full CI is still recommended.\n"
|
|
@@ -960,24 +965,20 @@ async function runCli(args, version, runtime = {}) {
|
|
|
960
965
|
...options.base !== void 0 ? { base: options.base } : {},
|
|
961
966
|
...options.env ? { environment: options.env } : {},
|
|
962
967
|
...runtime.signal ? { signal: runtime.signal } : {},
|
|
963
|
-
...runtime.createRelevanceProvider ? { createProvider: runtime.createRelevanceProvider } : {}
|
|
968
|
+
...runtime.createRelevanceProvider ? { createProvider: runtime.createRelevanceProvider } : {},
|
|
969
|
+
providerConcurrency: options.providerConcurrency
|
|
964
970
|
});
|
|
965
971
|
paths = selection.tests.filter((test) => test.selected).map((test) => test.file);
|
|
972
|
+
priority = new Map(
|
|
973
|
+
selection.tests.map((test) => [test.file, test.probability])
|
|
974
|
+
);
|
|
966
975
|
if (options.selectionOnly) {
|
|
967
976
|
writeOut(`${JSON.stringify(selection, null, 2)}
|
|
968
977
|
`);
|
|
969
978
|
exitCode = 0;
|
|
970
979
|
return;
|
|
971
980
|
}
|
|
972
|
-
writeErr(
|
|
973
|
-
`Affected selection: ${paths.length}/${selection.tests.length} tests, threshold ${selection.threshold}, base ${selection.base}.
|
|
974
|
-
`
|
|
975
|
-
);
|
|
976
|
-
for (const test of selection.tests)
|
|
977
|
-
writeErr(
|
|
978
|
-
`${test.selected ? "RUN " : "SKIP"} ${test.probability.toFixed(4)} ${JSON.stringify(test.file)} (${test.reason})
|
|
979
|
-
`
|
|
980
|
-
);
|
|
981
|
+
writeErr(selectionReport(selection));
|
|
981
982
|
if (!paths.length) {
|
|
982
983
|
writeErr("No relevant tests selected; no tests were executed.\n");
|
|
983
984
|
exitCode = 0;
|
|
@@ -1028,11 +1029,12 @@ No tests were run. Fix the selection error or run without --affected.
|
|
|
1028
1029
|
if (output) writeOut(output);
|
|
1029
1030
|
}
|
|
1030
1031
|
};
|
|
1031
|
-
const upload = options.cloud ? await (await import("./cloud-upload-
|
|
1032
|
+
const upload = options.cloud ? await (await import("./cloud-upload-TDT3GOTX.js")).prepareCloudUpload(process.cwd()) : void 0;
|
|
1032
1033
|
const execution = await executeRun({
|
|
1033
1034
|
command,
|
|
1034
1035
|
...runtime.onStrayRejection ? { onStrayRejection: runtime.onStrayRejection } : {},
|
|
1035
1036
|
paths,
|
|
1037
|
+
priority,
|
|
1036
1038
|
filters: {
|
|
1037
1039
|
include: options.include,
|
|
1038
1040
|
exclude: options.exclude,
|
|
@@ -1181,7 +1183,7 @@ No tests were run. Fix the selection error or run without --affected.
|
|
|
1181
1183
|
"after",
|
|
1182
1184
|
"\nGuided mode and --shrink make billable TypeSafe calls (TYPESAFE_API_KEY).\nSafety is off by default, for disposable staging: exploration clicks real buttons\nand completes forms. Use --safe on shared or production-like data.\n\nWrites trace.jsonl, result.json, report.md and report.html into --out/<run-id>/.\n\nExamples:\n sedum explore https://staging.example.com --steps 200 --seed 7 --replay\n sedum explore https://staging.example.com --safe --shrink\n sedum explore --rerun .sedum/explore/<run>/trace.jsonl\n\nExit codes:\n 0 no failures observed\n 1 console errors, page exceptions or HTTP 5xx observed\n 3 command or operational error\n"
|
|
1183
1185
|
).action(async (url, options) => {
|
|
1184
|
-
const { exploreAction } = await import("./explore-command-
|
|
1186
|
+
const { exploreAction } = await import("./explore-command-NXA36QIC.js");
|
|
1185
1187
|
exitCode = await exploreAction(url, options, {
|
|
1186
1188
|
cwd,
|
|
1187
1189
|
write: writeOut,
|
|
@@ -1203,7 +1205,7 @@ No tests were run. Fix the selection error or run without --affected.
|
|
|
1203
1205
|
"\nThe authenticated API check makes one small, potentially billable request.\n\nExit codes:\n 0 all checks passed\n 3 one or more prerequisites failed\n"
|
|
1204
1206
|
).action(
|
|
1205
1207
|
async (options) => {
|
|
1206
|
-
const { doctorOptions, executeDoctorCommand, renderDoctorText } = await import("./doctor-command-
|
|
1208
|
+
const { doctorOptions, executeDoctorCommand, renderDoctorText } = await import("./doctor-command-5YAF7YLZ.js");
|
|
1207
1209
|
const result = await executeDoctorCommand(
|
|
1208
1210
|
cwd,
|
|
1209
1211
|
runtime.doctorProbes,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
configDiagnostic
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NQY7NBC7.js";
|
|
4
4
|
import {
|
|
5
5
|
ProjectConfigError,
|
|
6
6
|
loadProjectConfig,
|
|
7
7
|
readProjectEnvironment
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KISBU2JR.js";
|
|
9
9
|
|
|
10
10
|
// src/explore-command.ts
|
|
11
11
|
import { randomInt } from "crypto";
|
|
@@ -4,6 +4,8 @@ import { isUtf8 } from "buffer";
|
|
|
4
4
|
var MAX_DIFF_BYTES = 16 * 1024 * 1024;
|
|
5
5
|
var AffectedSelectionError = class extends Error {
|
|
6
6
|
};
|
|
7
|
+
var GitInputTooLarge = class extends AffectedSelectionError {
|
|
8
|
+
};
|
|
7
9
|
function gitRead(cwd, args, signal, limit = MAX_DIFF_BYTES) {
|
|
8
10
|
return new Promise((resolve, reject) => {
|
|
9
11
|
const child = spawn("git", args, {
|
|
@@ -26,7 +28,7 @@ function gitRead(cwd, args, signal, limit = MAX_DIFF_BYTES) {
|
|
|
26
28
|
child.on("close", (code) => {
|
|
27
29
|
if (exceeded)
|
|
28
30
|
reject(
|
|
29
|
-
new
|
|
31
|
+
new GitInputTooLarge(
|
|
30
32
|
"Retained Git input exceeds the 16 MiB guard. Run the full suite; input was not truncated."
|
|
31
33
|
)
|
|
32
34
|
);
|
|
@@ -46,5 +48,6 @@ function decodeGitOutput(output) {
|
|
|
46
48
|
export {
|
|
47
49
|
MAX_DIFF_BYTES,
|
|
48
50
|
AffectedSelectionError,
|
|
51
|
+
GitInputTooLarge,
|
|
49
52
|
gitRead
|
|
50
53
|
};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
// src/config.ts
|
|
2
|
-
import { readFile, readdir } from "fs/promises";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { parseEnv } from "util";
|
|
5
|
-
import { minimatch as minimatch2 } from "minimatch";
|
|
6
|
-
import { isMap, LineCounter, parseDocument, visit } from "yaml";
|
|
7
|
-
|
|
8
1
|
// src/affected-paths.ts
|
|
2
|
+
import path from "path";
|
|
9
3
|
import { minimatch } from "minimatch";
|
|
10
4
|
function validAffectedGlob(pattern) {
|
|
11
5
|
if (!pattern.trim()) return false;
|
|
@@ -38,8 +32,45 @@ function affectedPathIgnored(file, patterns) {
|
|
|
38
32
|
})
|
|
39
33
|
);
|
|
40
34
|
}
|
|
35
|
+
var LOCKFILES = /* @__PURE__ */ new Set([
|
|
36
|
+
"package-lock.json",
|
|
37
|
+
"npm-shrinkwrap.json",
|
|
38
|
+
"pnpm-lock.yaml",
|
|
39
|
+
"yarn.lock",
|
|
40
|
+
"bun.lock",
|
|
41
|
+
"bun.lockb",
|
|
42
|
+
"deno.lock",
|
|
43
|
+
"Podfile.lock",
|
|
44
|
+
"Package.resolved",
|
|
45
|
+
"gradle.lockfile",
|
|
46
|
+
"libs.versions.toml",
|
|
47
|
+
"Gemfile.lock",
|
|
48
|
+
"poetry.lock",
|
|
49
|
+
"uv.lock",
|
|
50
|
+
"Pipfile.lock",
|
|
51
|
+
"go.sum",
|
|
52
|
+
"Cargo.lock",
|
|
53
|
+
"composer.lock",
|
|
54
|
+
"pubspec.lock",
|
|
55
|
+
"mix.lock",
|
|
56
|
+
"packages.lock.json",
|
|
57
|
+
"flake.lock"
|
|
58
|
+
]);
|
|
59
|
+
function runAllChange(changed, project, config) {
|
|
60
|
+
return changed.find((file) => {
|
|
61
|
+
if (file === config) return true;
|
|
62
|
+
if (!LOCKFILES.has(path.posix.basename(file))) return false;
|
|
63
|
+
const directory = path.posix.dirname(file);
|
|
64
|
+
return directory === "." || project === "" || directory === project || project.startsWith(`${directory}/`) || directory.startsWith(`${project}/`);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
41
67
|
|
|
42
68
|
// src/config.ts
|
|
69
|
+
import { readFile, readdir } from "fs/promises";
|
|
70
|
+
import path2 from "path";
|
|
71
|
+
import { parseEnv } from "util";
|
|
72
|
+
import { minimatch as minimatch2 } from "minimatch";
|
|
73
|
+
import { isMap, LineCounter, parseDocument, visit } from "yaml";
|
|
43
74
|
var CONFIG_FILE = "sedum.config.yaml";
|
|
44
75
|
var integrationCredentials = [
|
|
45
76
|
"TYPESAFE_API_KEY",
|
|
@@ -195,18 +226,18 @@ var REMOVED_KEYS = {
|
|
|
195
226
|
"vision.timeoutMs": "Vision fallback now uses the TypeSafe provider's request deadline.",
|
|
196
227
|
"vision.apiKeyEnv": "Vision fallback now uses the TypeSafe provider's API key."
|
|
197
228
|
};
|
|
198
|
-
function keyProblem(
|
|
199
|
-
const removed = Object.hasOwn(REMOVED_KEYS,
|
|
229
|
+
function keyProblem(path3, key, names) {
|
|
230
|
+
const removed = Object.hasOwn(REMOVED_KEYS, path3) ? REMOVED_KEYS[path3] : void 0;
|
|
200
231
|
if (removed)
|
|
201
232
|
return [
|
|
202
233
|
"removed_config_key",
|
|
203
|
-
`Configuration key \`${
|
|
204
|
-
`Delete \`${
|
|
234
|
+
`Configuration key \`${path3}\` was removed. ${removed}`,
|
|
235
|
+
`Delete \`${path3}\` from ${CONFIG_FILE}.`
|
|
205
236
|
];
|
|
206
237
|
if (names.has(key)) return null;
|
|
207
238
|
return [
|
|
208
239
|
"unknown_config_key",
|
|
209
|
-
`Unknown configuration key \`${
|
|
240
|
+
`Unknown configuration key \`${path3}\`.`,
|
|
210
241
|
keyFix(key, names)
|
|
211
242
|
];
|
|
212
243
|
}
|
|
@@ -214,15 +245,15 @@ function mapUnknownKeys(value, names, prefix, file, counter, diagnostics) {
|
|
|
214
245
|
if (!isMap(value)) return;
|
|
215
246
|
for (const pair of value.items) {
|
|
216
247
|
const key = String(pair.key);
|
|
217
|
-
const
|
|
218
|
-
const problem = keyProblem(
|
|
248
|
+
const path3 = prefix ? `${prefix}.${key}` : key;
|
|
249
|
+
const problem = keyProblem(path3, key, names);
|
|
219
250
|
if (problem)
|
|
220
251
|
diagnostic(
|
|
221
252
|
diagnostics,
|
|
222
253
|
file,
|
|
223
254
|
counter,
|
|
224
255
|
pair.key,
|
|
225
|
-
|
|
256
|
+
path3,
|
|
226
257
|
...problem
|
|
227
258
|
);
|
|
228
259
|
}
|
|
@@ -299,7 +330,7 @@ function scalarVariables(value, key, diagnostics, file, counter, node) {
|
|
|
299
330
|
}
|
|
300
331
|
function relativePath(root, value, fallback, key, diagnostics, file, counter, node) {
|
|
301
332
|
if (value === void 0) value = fallback;
|
|
302
|
-
if (typeof value !== "string" || value.length === 0 ||
|
|
333
|
+
if (typeof value !== "string" || value.length === 0 || path2.isAbsolute(value)) {
|
|
303
334
|
diagnostic(
|
|
304
335
|
diagnostics,
|
|
305
336
|
file,
|
|
@@ -310,11 +341,11 @@ function relativePath(root, value, fallback, key, diagnostics, file, counter, no
|
|
|
310
341
|
`Configuration key \`${key}\` must be a nonempty project-relative path.`,
|
|
311
342
|
`Use a relative path such as \`${fallback}\`.`
|
|
312
343
|
);
|
|
313
|
-
return
|
|
344
|
+
return path2.resolve(root, fallback);
|
|
314
345
|
}
|
|
315
|
-
const resolved =
|
|
316
|
-
const relation =
|
|
317
|
-
if (relation === ".." || relation.startsWith(`..${
|
|
346
|
+
const resolved = path2.resolve(root, value);
|
|
347
|
+
const relation = path2.relative(root, resolved);
|
|
348
|
+
if (relation === ".." || relation.startsWith(`..${path2.sep}`)) {
|
|
318
349
|
diagnostic(
|
|
319
350
|
diagnostics,
|
|
320
351
|
file,
|
|
@@ -325,7 +356,7 @@ function relativePath(root, value, fallback, key, diagnostics, file, counter, no
|
|
|
325
356
|
`Configuration key \`${key}\` escapes the project root.`,
|
|
326
357
|
"Choose a path inside the project root."
|
|
327
358
|
);
|
|
328
|
-
return
|
|
359
|
+
return path2.resolve(root, fallback);
|
|
329
360
|
}
|
|
330
361
|
return resolved;
|
|
331
362
|
}
|
|
@@ -442,7 +473,7 @@ function stringList(value, fallback, key, diagnostics, file, counter, node) {
|
|
|
442
473
|
return [...fallback];
|
|
443
474
|
}
|
|
444
475
|
for (const pattern of value) {
|
|
445
|
-
if (
|
|
476
|
+
if (path2.isAbsolute(pattern) || pattern.split(/[\\/]/u).includes(".."))
|
|
446
477
|
diagnostic(
|
|
447
478
|
diagnostics,
|
|
448
479
|
file,
|
|
@@ -479,9 +510,9 @@ function absoluteUrl(value, key, diagnostics, file, counter, node) {
|
|
|
479
510
|
}
|
|
480
511
|
}
|
|
481
512
|
async function findConfig(start) {
|
|
482
|
-
let current =
|
|
513
|
+
let current = path2.resolve(start);
|
|
483
514
|
for (; ; ) {
|
|
484
|
-
const candidate =
|
|
515
|
+
const candidate = path2.join(current, CONFIG_FILE);
|
|
485
516
|
try {
|
|
486
517
|
await readFile(candidate, "utf8");
|
|
487
518
|
return { root: current, file: candidate };
|
|
@@ -499,15 +530,15 @@ async function findConfig(start) {
|
|
|
499
530
|
}
|
|
500
531
|
]);
|
|
501
532
|
}
|
|
502
|
-
const parent =
|
|
503
|
-
if (parent === current) return { root:
|
|
533
|
+
const parent = path2.dirname(current);
|
|
534
|
+
if (parent === current) return { root: path2.resolve(start), file: null };
|
|
504
535
|
current = parent;
|
|
505
536
|
}
|
|
506
537
|
}
|
|
507
538
|
async function readProjectEnvironment(start) {
|
|
508
539
|
const { root } = await findConfig(start);
|
|
509
540
|
try {
|
|
510
|
-
return parseEnv(await readFile(
|
|
541
|
+
return parseEnv(await readFile(path2.join(root, ".env"), "utf8"));
|
|
511
542
|
} catch (error) {
|
|
512
543
|
if (error.code === "ENOENT") return {};
|
|
513
544
|
throw error;
|
|
@@ -643,7 +674,7 @@ async function readConfigDocument(file, counter, diagnostics) {
|
|
|
643
674
|
}
|
|
644
675
|
async function loadProjectConfig(start = process.cwd(), hostEnvironment = process.env, overrides = {}, loadOptions = {}) {
|
|
645
676
|
const found = await findConfig(start);
|
|
646
|
-
const file = found.file ??
|
|
677
|
+
const file = found.file ?? path2.join(found.root, CONFIG_FILE);
|
|
647
678
|
const counter = new LineCounter();
|
|
648
679
|
const diagnostics = [];
|
|
649
680
|
const { raw, document } = found.file ? await readConfigDocument(found.file, counter, diagnostics) : { raw: {}, document: null };
|
|
@@ -830,7 +861,7 @@ async function loadProjectConfig(start = process.cwd(), hostEnvironment = proces
|
|
|
830
861
|
node(`environments.${String(selected)}.variables`)
|
|
831
862
|
);
|
|
832
863
|
let fileEnvironment = {};
|
|
833
|
-
const environmentFile =
|
|
864
|
+
const environmentFile = path2.join(found.root, ".env");
|
|
834
865
|
try {
|
|
835
866
|
if (loadOptions.readEnvironmentFile !== false)
|
|
836
867
|
fileEnvironment = await readProjectEnvironment(found.root);
|
|
@@ -1128,10 +1159,10 @@ async function discoverConfiguredTests(config) {
|
|
|
1128
1159
|
}
|
|
1129
1160
|
for (const entry of entries) {
|
|
1130
1161
|
if (entry.isSymbolicLink()) continue;
|
|
1131
|
-
const absolute =
|
|
1162
|
+
const absolute = path2.join(directory, entry.name);
|
|
1132
1163
|
if (entry.isDirectory()) await visit2(absolute);
|
|
1133
1164
|
else if (entry.isFile()) {
|
|
1134
|
-
const relative =
|
|
1165
|
+
const relative = path2.relative(config.testDirectory, absolute).split(path2.sep).join("/");
|
|
1135
1166
|
if ((relative.endsWith(".test.ts") || relative.endsWith(".test.yaml")) && config.include.some((pattern) => minimatch2(relative, pattern)) && !config.exclude.some((pattern) => minimatch2(relative, pattern)))
|
|
1136
1167
|
files.push(absolute);
|
|
1137
1168
|
}
|
|
@@ -1144,6 +1175,7 @@ async function discoverConfiguredTests(config) {
|
|
|
1144
1175
|
export {
|
|
1145
1176
|
validAffectedGlob,
|
|
1146
1177
|
affectedPathIgnored,
|
|
1178
|
+
runAllChange,
|
|
1147
1179
|
ProjectConfigError,
|
|
1148
1180
|
DEFAULT_PROVIDER_BASE_URL,
|
|
1149
1181
|
DEFAULT_PROVIDER_MODEL,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
providerDiagnostic
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NQY7NBC7.js";
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_PROVIDER_BASE_URL,
|
|
6
6
|
DEFAULT_PROVIDER_MODEL,
|
|
7
7
|
ProjectConfigError,
|
|
8
8
|
loadProjectConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KISBU2JR.js";
|
|
10
10
|
|
|
11
11
|
// src/doctor-command.ts
|
|
12
12
|
import { lstat, mkdir, mkdtemp, rm, rmdir, writeFile } from "fs/promises";
|
package/dist/cli.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runCli,
|
|
4
4
|
sedumCommand
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-55HRCJCM.js";
|
|
6
6
|
import "./chunk-JYWNBHN7.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-5P4FY5IO.js";
|
|
8
8
|
import "./chunk-EFRMSNBD.js";
|
|
9
9
|
import "./chunk-N5CTUO2A.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-NQY7NBC7.js";
|
|
11
|
+
import "./chunk-KISBU2JR.js";
|
|
12
12
|
|
|
13
13
|
// src/cli.ts
|
|
14
14
|
import { createRequire } from "module";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
gitRead
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-A2CNICAJ.js";
|
|
4
4
|
import {
|
|
5
5
|
readProjectEnvironment
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KISBU2JR.js";
|
|
7
7
|
|
|
8
8
|
// src/cloud-upload.ts
|
|
9
9
|
import { setTimeout as delay } from "timers/promises";
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
keyPresent,
|
|
7
7
|
renderDoctorText,
|
|
8
8
|
supportedNode
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-LQM3ZUCR.js";
|
|
10
|
+
import "./chunk-NQY7NBC7.js";
|
|
11
|
+
import "./chunk-KISBU2JR.js";
|
|
12
12
|
export {
|
|
13
13
|
browserAvailable,
|
|
14
14
|
checkOutputWritable,
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
seedValue,
|
|
10
10
|
startUrl,
|
|
11
11
|
watchOrigin
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-5P4FY5IO.js";
|
|
13
|
+
import "./chunk-NQY7NBC7.js";
|
|
14
|
+
import "./chunk-KISBU2JR.js";
|
|
15
15
|
export {
|
|
16
16
|
EXPLORE_MODES,
|
|
17
17
|
collectText,
|
package/dist/index.d.ts
CHANGED
|
@@ -134,6 +134,11 @@ interface RunCommandOptions {
|
|
|
134
134
|
readonly onStrayRejection?: (message: string) => void;
|
|
135
135
|
readonly file?: string;
|
|
136
136
|
readonly paths?: readonly string[];
|
|
137
|
+
/**
|
|
138
|
+
* How relevant each project-relative test file is to the diff, as
|
|
139
|
+
* `--affected` scored it. Higher starts first; reports keep selection order.
|
|
140
|
+
*/
|
|
141
|
+
readonly priority?: ReadonlyMap<string, number>;
|
|
137
142
|
readonly filters?: RunFilters;
|
|
138
143
|
/**
|
|
139
144
|
* `--non-blocking-labels`: tests with any of these tags run and are
|
package/dist/index.js
CHANGED
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
renderRunSummary,
|
|
3
3
|
runCli,
|
|
4
4
|
runExitCode
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-55HRCJCM.js";
|
|
6
6
|
import "./chunk-JYWNBHN7.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-5P4FY5IO.js";
|
|
8
8
|
import "./chunk-EFRMSNBD.js";
|
|
9
9
|
import "./chunk-N5CTUO2A.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-NQY7NBC7.js";
|
|
11
11
|
import {
|
|
12
12
|
ProjectConfigError,
|
|
13
13
|
discoverConfiguredTests,
|
|
14
14
|
loadProjectConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KISBU2JR.js";
|
|
16
16
|
|
|
17
17
|
// src/index.ts
|
|
18
18
|
import { test, expect, secret } from "@sedum-dev/core/script";
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
browserAvailable,
|
|
3
3
|
keyPresent,
|
|
4
4
|
supportedNode
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-LQM3ZUCR.js";
|
|
6
|
+
import "./chunk-NQY7NBC7.js";
|
|
7
7
|
import {
|
|
8
8
|
ProjectConfigError,
|
|
9
9
|
loadProjectConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KISBU2JR.js";
|
|
11
11
|
|
|
12
12
|
// src/init-command.ts
|
|
13
13
|
import { constants } from "fs";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-EFRMSNBD.js";
|
|
6
6
|
import {
|
|
7
7
|
discoverRunTests
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PMBUVQVS.js";
|
|
9
9
|
import {
|
|
10
10
|
createCliProvider
|
|
11
11
|
} from "./chunk-N5CTUO2A.js";
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
outputDiagnostic,
|
|
17
17
|
setupDiagnostic,
|
|
18
18
|
stopsRun
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NQY7NBC7.js";
|
|
20
20
|
import {
|
|
21
21
|
ProjectConfigError,
|
|
22
22
|
loadProjectConfig
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-KISBU2JR.js";
|
|
24
24
|
|
|
25
25
|
// src/run-command/implementation.ts
|
|
26
26
|
import {
|
|
@@ -71,7 +71,8 @@ async function discoverCommandTests(config, options, safeText2) {
|
|
|
71
71
|
const files = selected.map((test) => ({
|
|
72
72
|
file: path.join(config.projectRoot, test.file),
|
|
73
73
|
id: test.id,
|
|
74
|
-
blocking: !test.tags.some((tag) => nonBlocking.includes(tag))
|
|
74
|
+
blocking: !test.tags.some((tag) => nonBlocking.includes(tag)),
|
|
75
|
+
priority: options.priority?.get(test.file) ?? 0
|
|
75
76
|
}));
|
|
76
77
|
const problems = [
|
|
77
78
|
...selection.problems,
|
|
@@ -1164,10 +1165,10 @@ async function executeSelectedTests(request) {
|
|
|
1164
1165
|
const outcome = { operational: null, erroredTests: 0 };
|
|
1165
1166
|
try {
|
|
1166
1167
|
await runPool({
|
|
1167
|
-
items: request.files,
|
|
1168
|
+
items: startOrder(request.files),
|
|
1168
1169
|
lanes,
|
|
1169
1170
|
signal: request.signal,
|
|
1170
|
-
run: (test,
|
|
1171
|
+
run: ({ test, ordinal }, lane) => runSelectedTest(
|
|
1171
1172
|
request,
|
|
1172
1173
|
resources,
|
|
1173
1174
|
{ browser: browsers[lane], test, lane, ordinal },
|
|
@@ -1180,6 +1181,11 @@ async function executeSelectedTests(request) {
|
|
|
1180
1181
|
}
|
|
1181
1182
|
return outcome;
|
|
1182
1183
|
}
|
|
1184
|
+
function startOrder(files) {
|
|
1185
|
+
return files.map((test, ordinal) => ({ test, ordinal })).sort(
|
|
1186
|
+
(a, b) => (b.test.priority ?? 0) - (a.test.priority ?? 0) || a.ordinal - b.ordinal
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1183
1189
|
async function visionModel(config) {
|
|
1184
1190
|
if (!config.vision.enabled) return null;
|
|
1185
1191
|
const { IMAGE_MODEL } = await import("@sedum-dev/provider-typesafe");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sedum-cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.23",
|
|
4
4
|
"description": "Plain-English browser tests on Playwright. Write steps as sentences, keep TypeScript, and run the suite on every pull request.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"playwright",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"minimatch": "10.2.6",
|
|
45
45
|
"yaml": "2.9.1",
|
|
46
46
|
"zod": "4.6.7",
|
|
47
|
-
"@sedum-dev/core": "0.1.0-alpha.
|
|
48
|
-
"@sedum-dev/provider-
|
|
49
|
-
"@sedum-dev/provider-
|
|
50
|
-
"@sedum-dev/reporters": "0.1.0-alpha.
|
|
47
|
+
"@sedum-dev/core": "0.1.0-alpha.23",
|
|
48
|
+
"@sedum-dev/provider-clef": "0.1.0-alpha.23",
|
|
49
|
+
"@sedum-dev/provider-typesafe": "0.1.0-alpha.23",
|
|
50
|
+
"@sedum-dev/reporters": "0.1.0-alpha.23"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsup src/index.ts src/cli.ts --format esm --dts --clean --out-dir dist",
|