sedum-cli 0.1.0-alpha.20 → 0.1.0-alpha.22

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.
@@ -323,10 +323,6 @@ Fix: ${diagnostic.fix}`
323
323
  }
324
324
  throw error;
325
325
  }
326
- let candidateIndex = 0;
327
- const probabilities = tests.map(
328
- (_, index) => forced[index] ? 1 : scores.probabilities[candidateIndex++]
329
- );
330
326
  return {
331
327
  base: branch.base,
332
328
  head: branch.head,
@@ -337,14 +333,33 @@ Fix: ${diagnostic.fix}`
337
333
  aggregation: "max",
338
334
  threshold: options.threshold,
339
335
  calls: scores.calls,
340
- tests: tests.map((test, index) => ({
341
- file: test.file,
342
- probability: probabilities[index],
343
- selected: forced[index] || branch.diff !== "" && probabilities[index] >= options.threshold,
344
- reason: forced[index] ? "test-or-module-changed" : branch.diff ? "model" : branch.ignoredFiles.length ? "all-ignored" : "no-diff"
345
- }))
336
+ tests: decideTests(tests, forced, scores, {
337
+ diff: branch.diff,
338
+ ignored: branch.ignoredFiles.length > 0,
339
+ threshold: options.threshold
340
+ })
346
341
  };
347
342
  }
343
+ function decideTests(tests, forced, scores, context) {
344
+ const oversized = new Set(scores.oversized ?? []);
345
+ const fallback = context.diff ? "model" : context.ignored ? "all-ignored" : "no-diff";
346
+ let candidate = 0;
347
+ return tests.map((test, index) => {
348
+ if (forced[index]) return run(test, "test-or-module-changed");
349
+ const current = candidate++;
350
+ if (oversized.has(current)) return run(test, "too-large-to-score");
351
+ const probability = scores.probabilities[current];
352
+ return {
353
+ file: test.file,
354
+ probability,
355
+ selected: context.diff !== "" && probability >= context.threshold,
356
+ reason: fallback
357
+ };
358
+ });
359
+ }
360
+ function run(test, reason) {
361
+ return { file: test.file, probability: 1, selected: true, reason };
362
+ }
348
363
  export {
349
364
  AffectedSelectionError,
350
365
  readBranchDiff,
@@ -60,7 +60,7 @@ function listExitCode(listing, failedBeforeListing) {
60
60
  }
61
61
 
62
62
  // src/output.ts
63
- import { validateRunResult as validateRunResult2 } from "@sedum-dev/core";
63
+ import { isBlocking, validateRunResult as validateRunResult2 } from "@sedum-dev/core";
64
64
  import { testLabel, usageLines, visionSummary } from "@sedum-dev/reporters";
65
65
  var ansi = {
66
66
  green: "\x1B[32m",
@@ -207,9 +207,13 @@ function discoveryLine(problem) {
207
207
  return `discovery ${problem.file}${location}: ${problem.message} Fix: ${problem.fix}`;
208
208
  }
209
209
  function testCountLine(value) {
210
- const errored = value.tests.filter((test) => test.state === "error").length;
210
+ const errored = value.tests.filter(
211
+ (test) => isBlocking(test) && test.state === "error"
212
+ ).length;
211
213
  const errorCount = errored ? `, ${errored} could not run` : "";
212
- return `tests ${value.totals.selectedTests} selected, ${value.totals.executedTests} executed, ${value.totals.passedTests} passed, ${value.totals.failedTests} failed${errorCount}`;
214
+ const nonBlocking = value.totals.nonBlockingFailedTests;
215
+ const nonBlockingCount = nonBlocking === void 0 ? "" : `, ${nonBlocking} non-blocking failed`;
216
+ return `tests ${value.totals.selectedTests} selected, ${value.totals.executedTests} executed, ${value.totals.passedTests} passed, ${value.totals.failedTests} failed${errorCount}${nonBlockingCount}`;
213
217
  }
214
218
  function flagCountLine(value, counts) {
215
219
  const flaky = value.tests.filter(
@@ -861,7 +865,7 @@ async function runCli(args, version, runtime = {}) {
861
865
  const writeOut = (value) => rawOut(withCommand(value, command));
862
866
  const writeErr = (value) => rawErr(withCommand(value, command));
863
867
  const capabilities = runtime.capabilities ?? plainOutput;
864
- const executeRun = runtime.executeRun ?? (async (options) => (await import("./run-command-WYSLSLYM.js")).executeRunCommand(options));
868
+ const executeRun = runtime.executeRun ?? (async (options) => (await import("./run-command-6UTIJAHU.js")).executeRunCommand(options));
865
869
  const cwd = runtime.cwd ?? process.cwd();
866
870
  let exitCode = 3;
867
871
  const program = createProgram(version, writeOut, writeErr);
@@ -901,113 +905,9 @@ async function runCli(args, version, runtime = {}) {
901
905
  writeErr(result.stderr);
902
906
  exitCode = result.exitCode;
903
907
  });
904
- program.command("run").description("run configured tests, files, or directories").argument(
905
- "[paths...]",
906
- "test files or directories relative to the project root"
907
- ).option(
908
- "--affected",
909
- "experimental: send Git diff and test sources to the text provider; run relevant tests",
910
- false
911
- ).option("--base <ref>", "base ref for --affected (default main or master)").option(
912
- "--affected-ignore <glob>",
913
- "exclude matching repository-relative diff paths (repeatable)",
914
- collectAffectedGlob,
915
- []
916
- ).option(
917
- "--threshold <probability>",
918
- "minimum relevance probability for --affected (default 0.3)",
919
- relevanceThreshold
920
- ).option(
921
- "--selection-only",
922
- "with --affected, print selection JSON without running tests (calls the text provider)",
923
- false
924
- ).option(
925
- "--include <glob>",
926
- "include matching project-relative paths (repeatable)",
927
- collectGlob,
928
- []
929
- ).option(
930
- "--exclude <glob>",
931
- "exclude matching project-relative paths (repeatable)",
932
- collectGlob,
933
- []
934
- ).option(
935
- "--labels <tags>",
936
- "require all comma-separated test tags (repeatable)",
937
- collectLabels,
938
- []
939
- ).option(
940
- "--name <text>",
941
- "match id or description substring (repeatable)",
942
- collectValue,
943
- []
944
- ).option(
945
- "--id <id>",
946
- "select a test by its exact id (repeatable)",
947
- collectValue,
948
- []
949
- ).option("--env <name>", "select a named environment").option("--browser <kind>", "chrome or chromium").option("--vision", "enable vision fallback for ambiguous clicks").option("--no-vision", "disable vision fallback").option(
950
- "--screenshots",
951
- "send screenshots to TypeSafe to check targets and judge claims (default for the TypeSafe API)"
952
- ).option("--no-screenshots", "send page text only, never screenshots").option(
953
- "--url-override <url>",
954
- "replace entry URL origin for preview deployments"
955
- ).option("--output-dir <path>", "run output directory").option("--reporter-dir <path>", "reporter artifact directory").option("--headed", "show the browser", false).option(
956
- "--slow <ms>",
957
- "slow browser actions by milliseconds",
958
- nonnegativeSlow
959
- ).option(
960
- "--retries <count>",
961
- "additional whole-test attempts",
962
- nonnegativeInteger,
963
- 0
964
- ).option(
965
- "--timeout-minutes <minutes>",
966
- "whole-run deadline",
967
- positiveMinutes
968
- ).option(
969
- "--parallel <n|auto>",
970
- "run tests in parallel lanes; auto uses half the CPU cores (default 1)",
971
- parallelValue
972
- ).option(
973
- "--shard-index <index>",
974
- "run only this 1-based shard of the selection (with --shard-count)",
975
- positiveCount(1e4)
976
- ).option(
977
- "--shard-count <count>",
978
- "split the selection into this many deterministic shards",
979
- positiveCount(1e4)
980
- ).option(
981
- "--provider-concurrency <n>",
982
- "cap concurrent model-provider requests (default min(4, 2 x lanes))",
983
- positiveCount(32)
984
- ).option("--replay", "capture replay frames for executed steps", false).option("--no-evidence", "disable non-passing evidence frames").option("--no-cloud", "disable automatic upload to Sedum Cloud").option("--no-locator-cache", "disable the local locator cache").option("--locator-cache-ci", "enable the local locator cache in CI", false).option(
985
- "--sensitive-origin <url>",
986
- "omit sensitive page details and frames (repeatable)",
987
- collectOrigin,
988
- []
989
- ).option(
990
- "--detect <mode>",
991
- "flag steps whose page reported console errors, uncaught exceptions, unhandled rejections, or HTTP errors: off, browser, or semantic (also asks Jev whether each new page looks broken)",
992
- detectMode
993
- ).option(
994
- "--detect-allow <rule>",
995
- "ignore a known detector finding: [check:]substring or [check:]re:regex (repeatable)",
996
- collectAllowRule,
997
- []
998
- ).option("--strict", "exit 2 when a passed run has uncertainty flags", false).option(
999
- "--reporter <name>",
1000
- "reporter: list, steps, terminal, json, markdown, or junit (repeatable or comma-separated; default list)",
1001
- collectReporter,
1002
- []
1003
- ).option(
1004
- "--costs",
1005
- "show model tokens and cost even when stdout is redirected",
1006
- false
1007
- ).addHelpText(
1008
- "after",
1009
- "\nPrerequisites:\n Install Chromium with `sedum browsers install chromium` and configure the selected provider's credentials. TypeSafe uses TYPESAFE_API_KEY (and TYPESAFE_BASE_URL for a compatible gateway); OpenRouter uses OPENROUTER_API_KEY; Clef uses CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_AUTH_TOKEN.\n\nExamples:\n sedum run tests/login.test.ts\n sedum run tests/login.test.ts --id 'tests/login.test.ts#signs in'\n sedum run tests/login.test.yaml --strict --costs\n"
1010
- ).action(
908
+ addRunReportOptions(
909
+ addRunExecutionOptions(addRunSelectionOptions(program.command("run")))
910
+ ).description("run configured tests, files, or directories").action(
1011
911
  async (paths, options) => {
1012
912
  if (options.shardIndex === void 0 !== (options.shardCount === void 0) || options.shardIndex !== void 0 && options.shardIndex > options.shardCount) {
1013
913
  writeErr(
@@ -1039,7 +939,7 @@ async function runCli(args, version, runtime = {}) {
1039
939
  return;
1040
940
  }
1041
941
  if (options.affected) {
1042
- const { selectAffectedTests, AffectedSelectionError } = await import("./affected-selection-NTBVWIK5.js");
942
+ const { selectAffectedTests, AffectedSelectionError } = await import("./affected-selection-7XPP7NKZ.js");
1043
943
  const { ProviderError: ProviderError2 } = await import("@sedum-dev/core");
1044
944
  writeErr(
1045
945
  "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"
@@ -1140,6 +1040,7 @@ No tests were run. Fix the selection error or run without --affected.
1140
1040
  names: options.name,
1141
1041
  ids: options.id
1142
1042
  },
1043
+ nonBlockingLabels: options.nonBlockingLabels,
1143
1044
  ...options.env ? { environment: options.env } : {},
1144
1045
  ...options.browser ? { browser: options.browser } : {},
1145
1046
  ...options.vision !== void 0 ? { vision: options.vision } : {},
@@ -1427,6 +1328,126 @@ Fix: rerun the command; if it happens again, report it with the run's result.jso
1427
1328
  }
1428
1329
  return { stdout: stdout.join(""), stderr: stderr.join(""), exitCode };
1429
1330
  }
1331
+ function addRunSelectionOptions(command) {
1332
+ return command.argument(
1333
+ "[paths...]",
1334
+ "test files or directories relative to the project root"
1335
+ ).option(
1336
+ "--affected",
1337
+ "experimental: send Git diff and test sources to the text provider; run relevant tests",
1338
+ false
1339
+ ).option("--base <ref>", "base ref for --affected (default main or master)").option(
1340
+ "--affected-ignore <glob>",
1341
+ "exclude matching repository-relative diff paths (repeatable)",
1342
+ collectAffectedGlob,
1343
+ []
1344
+ ).option(
1345
+ "--threshold <probability>",
1346
+ "minimum relevance probability for --affected (default 0.3)",
1347
+ relevanceThreshold
1348
+ ).option(
1349
+ "--selection-only",
1350
+ "with --affected, print selection JSON without running tests (calls the text provider)",
1351
+ false
1352
+ ).option(
1353
+ "--include <glob>",
1354
+ "include matching project-relative paths (repeatable)",
1355
+ collectGlob,
1356
+ []
1357
+ ).option(
1358
+ "--exclude <glob>",
1359
+ "exclude matching project-relative paths (repeatable)",
1360
+ collectGlob,
1361
+ []
1362
+ ).option(
1363
+ "--labels <tags>",
1364
+ "require all comma-separated test tags (repeatable)",
1365
+ collectLabels,
1366
+ []
1367
+ ).option(
1368
+ "--non-blocking-labels <tags>",
1369
+ "run tests with any of these comma-separated tags, but do not let their failures fail the run (repeatable)",
1370
+ collectLabels,
1371
+ []
1372
+ ).option(
1373
+ "--name <text>",
1374
+ "match id or description substring (repeatable)",
1375
+ collectValue,
1376
+ []
1377
+ ).option(
1378
+ "--id <id>",
1379
+ "select a test by its exact id (repeatable)",
1380
+ collectValue,
1381
+ []
1382
+ );
1383
+ }
1384
+ function addRunExecutionOptions(command) {
1385
+ return command.option("--env <name>", "select a named environment").option("--browser <kind>", "chrome or chromium").option("--vision", "enable vision fallback for ambiguous clicks").option("--no-vision", "disable vision fallback").option(
1386
+ "--screenshots",
1387
+ "send screenshots to TypeSafe to check targets and judge claims (default for the TypeSafe API)"
1388
+ ).option("--no-screenshots", "send page text only, never screenshots").option(
1389
+ "--url-override <url>",
1390
+ "replace entry URL origin for preview deployments"
1391
+ ).option("--output-dir <path>", "run output directory").option("--reporter-dir <path>", "reporter artifact directory").option("--headed", "show the browser", false).option(
1392
+ "--slow <ms>",
1393
+ "slow browser actions by milliseconds",
1394
+ nonnegativeSlow
1395
+ ).option(
1396
+ "--retries <count>",
1397
+ "additional whole-test attempts",
1398
+ nonnegativeInteger,
1399
+ 0
1400
+ ).option(
1401
+ "--timeout-minutes <minutes>",
1402
+ "whole-run deadline",
1403
+ positiveMinutes
1404
+ ).option(
1405
+ "--parallel <n|auto>",
1406
+ "run tests in parallel lanes; auto uses half the CPU cores (default 1)",
1407
+ parallelValue
1408
+ ).option(
1409
+ "--shard-index <index>",
1410
+ "run only this 1-based shard of the selection (with --shard-count)",
1411
+ positiveCount(1e4)
1412
+ ).option(
1413
+ "--shard-count <count>",
1414
+ "split the selection into this many deterministic shards",
1415
+ positiveCount(1e4)
1416
+ ).option(
1417
+ "--provider-concurrency <n>",
1418
+ "cap concurrent model-provider requests (default min(4, 2 x lanes))",
1419
+ positiveCount(32)
1420
+ );
1421
+ }
1422
+ function addRunReportOptions(command) {
1423
+ return command.option("--replay", "capture replay frames for executed steps", false).option("--no-evidence", "disable non-passing evidence frames").option("--no-cloud", "disable automatic upload to Sedum Cloud").option("--no-locator-cache", "disable the local locator cache").option("--locator-cache-ci", "enable the local locator cache in CI", false).option(
1424
+ "--sensitive-origin <url>",
1425
+ "omit sensitive page details and frames (repeatable)",
1426
+ collectOrigin,
1427
+ []
1428
+ ).option(
1429
+ "--detect <mode>",
1430
+ "flag steps whose page reported console errors, uncaught exceptions, unhandled rejections, or HTTP errors: off, browser, or semantic (also asks Jev whether each new page looks broken)",
1431
+ detectMode
1432
+ ).option(
1433
+ "--detect-allow <rule>",
1434
+ "ignore a known detector finding: [check:]substring or [check:]re:regex (repeatable)",
1435
+ collectAllowRule,
1436
+ []
1437
+ ).option("--strict", "exit 2 when a passed run has uncertainty flags", false).option(
1438
+ "--reporter <name>",
1439
+ "reporter: list, steps, terminal, json, markdown, or junit (repeatable or comma-separated; default list)",
1440
+ collectReporter,
1441
+ []
1442
+ ).option(
1443
+ "--costs",
1444
+ "show model tokens and cost even when stdout is redirected",
1445
+ false
1446
+ ).addHelpText(
1447
+ "after",
1448
+ "\nPrerequisites:\n Install Chromium with `sedum browsers install chromium` and configure the selected provider's credentials. TypeSafe uses TYPESAFE_API_KEY (and TYPESAFE_BASE_URL for a compatible gateway); OpenRouter uses OPENROUTER_API_KEY; Clef uses CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_AUTH_TOKEN.\n\nExamples:\n sedum run tests/login.test.ts\n sedum run tests/login.test.ts --id 'tests/login.test.ts#signs in'\n sedum run tests/login.test.yaml --strict --costs\n sedum run --non-blocking-labels quarantine\n"
1449
+ );
1450
+ }
1430
1451
  function createProgram(version, writeOut, writeErr) {
1431
1452
  const program = new Command2().name("sedum").description(
1432
1453
  "Run plain-English browser tests with deterministic automation."
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runCli,
4
4
  sedumCommand
5
- } from "./chunk-KMWECJ4D.js";
5
+ } from "./chunk-7RXHCQFR.js";
6
6
  import "./chunk-JYWNBHN7.js";
7
7
  import "./chunk-FOGLJA3Z.js";
8
8
  import "./chunk-EFRMSNBD.js";
package/dist/index.d.ts CHANGED
@@ -135,6 +135,11 @@ interface RunCommandOptions {
135
135
  readonly file?: string;
136
136
  readonly paths?: readonly string[];
137
137
  readonly filters?: RunFilters;
138
+ /**
139
+ * `--non-blocking-labels`: tests with any of these tags run and are
140
+ * reported, but their failures and errors do not decide the run.
141
+ */
142
+ readonly nonBlockingLabels?: readonly string[];
138
143
  readonly environment?: string;
139
144
  readonly browser?: string;
140
145
  readonly vision?: boolean;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  renderRunSummary,
3
3
  runCli,
4
4
  runExitCode
5
- } from "./chunk-KMWECJ4D.js";
5
+ } from "./chunk-7RXHCQFR.js";
6
6
  import "./chunk-JYWNBHN7.js";
7
7
  import "./chunk-FOGLJA3Z.js";
8
8
  import "./chunk-EFRMSNBD.js";
@@ -67,9 +67,11 @@ async function discoverCommandTests(config, options, safeText2) {
67
67
  options.filters
68
68
  );
69
69
  const selected = options.shard ? shardTests(selection.tests, options.shard) : selection.tests;
70
+ const nonBlocking = options.nonBlockingLabels ?? [];
70
71
  const files = selected.map((test) => ({
71
72
  file: path.join(config.projectRoot, test.file),
72
- id: test.id
73
+ id: test.id,
74
+ blocking: !test.tags.some((tag) => nonBlocking.includes(tag))
73
75
  }));
74
76
  const problems = [
75
77
  ...selection.problems,
@@ -1184,15 +1186,19 @@ async function visionModel(config) {
1184
1186
  return IMAGE_MODEL;
1185
1187
  }
1186
1188
  async function selectTests(request, lanes, providerConcurrency, visionModel2) {
1187
- await request.recorder.selectTests(request.files.length, {
1188
- parallel: { requested: request.options.parallel ?? 1, lanes },
1189
- shard: request.options.shard ? {
1190
- ...request.options.shard,
1191
- globalSelectedTests: request.globalSelectedTests
1192
- } : null,
1193
- providerConcurrency,
1194
- ...visionModel2 ? { vision: { model: visionModel2 } } : {}
1195
- });
1189
+ await request.recorder.selectTests(
1190
+ request.files.length,
1191
+ {
1192
+ parallel: { requested: request.options.parallel ?? 1, lanes },
1193
+ shard: request.options.shard ? {
1194
+ ...request.options.shard,
1195
+ globalSelectedTests: request.globalSelectedTests
1196
+ } : null,
1197
+ providerConcurrency,
1198
+ ...visionModel2 ? { vision: { model: visionModel2 } } : {}
1199
+ },
1200
+ request.files.filter((test) => !test.blocking).map((test) => test.id)
1201
+ );
1196
1202
  if (request.discoveryProblems.length)
1197
1203
  await request.recorder.addDiscoveryProblems(request.discoveryProblems);
1198
1204
  }
@@ -1305,10 +1311,16 @@ async function handleOperationalFailure(request, slot, result, outcome) {
1305
1311
  request.config.providerName,
1306
1312
  request.config.apiKeyEnv
1307
1313
  );
1308
- outcome.operational ??= diagnostic;
1309
- if (stopsRun(result.code)) return "stop";
1310
- outcome.erroredTests += 1;
1311
- await request.recorder.testAt(slot.ordinal)?.errorTest(canonicalDiagnosticError(diagnostic));
1314
+ if (stopsRun(result.code)) {
1315
+ outcome.operational ??= diagnostic;
1316
+ return "stop";
1317
+ }
1318
+ const recording = request.recorder.testAt(slot.ordinal);
1319
+ if (slot.test.blocking || !recording) {
1320
+ outcome.operational ??= diagnostic;
1321
+ outcome.erroredTests += 1;
1322
+ }
1323
+ await recording?.errorTest(canonicalDiagnosticError(diagnostic));
1312
1324
  return "complete";
1313
1325
  }
1314
1326
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sedum-cli",
3
- "version": "0.1.0-alpha.20",
3
+ "version": "0.1.0-alpha.22",
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.20",
48
- "@sedum-dev/provider-clef": "0.1.0-alpha.20",
49
- "@sedum-dev/provider-typesafe": "0.1.0-alpha.20",
50
- "@sedum-dev/reporters": "0.1.0-alpha.20"
47
+ "@sedum-dev/core": "0.1.0-alpha.22",
48
+ "@sedum-dev/provider-typesafe": "0.1.0-alpha.22",
49
+ "@sedum-dev/provider-clef": "0.1.0-alpha.22",
50
+ "@sedum-dev/reporters": "0.1.0-alpha.22"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsup src/index.ts src/cli.ts --format esm --dts --clean --out-dir dist",