donobu 5.61.1 → 5.61.3

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.
@@ -18,12 +18,20 @@ declare function ensureReporterValueHasJson(value: string): {
18
18
  * caller to fall back to the rerun's own exit code rather than assume success.
19
19
  */
20
20
  declare function countUnexpectedTests(report: DonobuReport): number | undefined;
21
+ /**
22
+ * Reconcile a run's process status with its recorded report. The child process
23
+ * is normally authoritative, but wrappers can surface exit 0 even when the
24
+ * report records unexpected failures. Escalate only zero exits so infra and
25
+ * crash codes keep their original signal.
26
+ */
27
+ declare function reconcileExitCodeWithReport(exitCode: number, report: DonobuReport | null): number;
21
28
  /** @internal Exposed for unit tests only — not part of the public API. */
22
29
  export declare const _forTesting: {
23
30
  countUnexpectedTests: typeof countUnexpectedTests;
24
31
  ensureReporterValueHasJson: typeof ensureReporterValueHasJson;
25
32
  hasReporterArg: typeof hasReporterArg;
26
33
  injectJsonReporterIntoArgs: typeof injectJsonReporterIntoArgs;
34
+ reconcileExitCodeWithReport: typeof reconcileExitCodeWithReport;
27
35
  };
28
36
  export {};
29
37
  //# sourceMappingURL=donobu-cli.d.ts.map
@@ -1510,7 +1510,45 @@ async function attemptAutoHealRun(params) {
1510
1510
  function countUnexpectedTests(report) {
1511
1511
  const stats = report.stats;
1512
1512
  const unexpected = stats?.unexpected;
1513
- return typeof unexpected === 'number' ? unexpected : undefined;
1513
+ if (typeof unexpected === 'number') {
1514
+ return unexpected;
1515
+ }
1516
+ const suites = (report.suites ?? []);
1517
+ if (suites.length === 0) {
1518
+ return undefined;
1519
+ }
1520
+ let failures = 0;
1521
+ for (const suite of suites) {
1522
+ for (const spec of (0, reportWalk_1.collectSpecs)(suite)) {
1523
+ for (const test of spec.tests ?? []) {
1524
+ const status = (0, reportWalk_1.statusOf)(test);
1525
+ if (status === 'failed' ||
1526
+ status === 'timedOut' ||
1527
+ status === 'interrupted' ||
1528
+ status === 'unknown') {
1529
+ failures += 1;
1530
+ }
1531
+ }
1532
+ }
1533
+ }
1534
+ return failures;
1535
+ }
1536
+ /**
1537
+ * Reconcile a run's process status with its recorded report. The child process
1538
+ * is normally authoritative, but wrappers can surface exit 0 even when the
1539
+ * report records unexpected failures. Escalate only zero exits so infra and
1540
+ * crash codes keep their original signal.
1541
+ */
1542
+ function reconcileExitCodeWithReport(exitCode, report) {
1543
+ if (exitCode !== 0 || !report) {
1544
+ return exitCode;
1545
+ }
1546
+ const unexpected = countUnexpectedTests(report);
1547
+ if (unexpected !== undefined && unexpected > 0) {
1548
+ Logger_1.appLogger.warn(`Run exited 0 but the report records ${unexpected} failed test(s); exiting non-zero.`);
1549
+ return 1;
1550
+ }
1551
+ return exitCode;
1514
1552
  }
1515
1553
  /**
1516
1554
  * Find a test entry in a report by title + project name. File paths are
@@ -2038,6 +2076,7 @@ async function runTestCommand(cliArgs) {
2038
2076
  // guarantee the reporter was deferring for.
2039
2077
  await postDeferredSlackFromInitialRun(playwrightOutputDir);
2040
2078
  }
2079
+ return reconcileExitCodeWithReport(autoHealOutcome.exitCode, enrichedInitialReport ?? initialDonobuReport);
2041
2080
  }
2042
2081
  return autoHealOutcome.exitCode;
2043
2082
  }
@@ -2268,5 +2307,6 @@ exports._forTesting = {
2268
2307
  ensureReporterValueHasJson,
2269
2308
  hasReporterArg,
2270
2309
  injectJsonReporterIntoArgs,
2310
+ reconcileExitCodeWithReport,
2271
2311
  };
2272
2312
  //# sourceMappingURL=donobu-cli.js.map
@@ -18,12 +18,20 @@ declare function ensureReporterValueHasJson(value: string): {
18
18
  * caller to fall back to the rerun's own exit code rather than assume success.
19
19
  */
20
20
  declare function countUnexpectedTests(report: DonobuReport): number | undefined;
21
+ /**
22
+ * Reconcile a run's process status with its recorded report. The child process
23
+ * is normally authoritative, but wrappers can surface exit 0 even when the
24
+ * report records unexpected failures. Escalate only zero exits so infra and
25
+ * crash codes keep their original signal.
26
+ */
27
+ declare function reconcileExitCodeWithReport(exitCode: number, report: DonobuReport | null): number;
21
28
  /** @internal Exposed for unit tests only — not part of the public API. */
22
29
  export declare const _forTesting: {
23
30
  countUnexpectedTests: typeof countUnexpectedTests;
24
31
  ensureReporterValueHasJson: typeof ensureReporterValueHasJson;
25
32
  hasReporterArg: typeof hasReporterArg;
26
33
  injectJsonReporterIntoArgs: typeof injectJsonReporterIntoArgs;
34
+ reconcileExitCodeWithReport: typeof reconcileExitCodeWithReport;
27
35
  };
28
36
  export {};
29
37
  //# sourceMappingURL=donobu-cli.d.ts.map
@@ -1510,7 +1510,45 @@ async function attemptAutoHealRun(params) {
1510
1510
  function countUnexpectedTests(report) {
1511
1511
  const stats = report.stats;
1512
1512
  const unexpected = stats?.unexpected;
1513
- return typeof unexpected === 'number' ? unexpected : undefined;
1513
+ if (typeof unexpected === 'number') {
1514
+ return unexpected;
1515
+ }
1516
+ const suites = (report.suites ?? []);
1517
+ if (suites.length === 0) {
1518
+ return undefined;
1519
+ }
1520
+ let failures = 0;
1521
+ for (const suite of suites) {
1522
+ for (const spec of (0, reportWalk_1.collectSpecs)(suite)) {
1523
+ for (const test of spec.tests ?? []) {
1524
+ const status = (0, reportWalk_1.statusOf)(test);
1525
+ if (status === 'failed' ||
1526
+ status === 'timedOut' ||
1527
+ status === 'interrupted' ||
1528
+ status === 'unknown') {
1529
+ failures += 1;
1530
+ }
1531
+ }
1532
+ }
1533
+ }
1534
+ return failures;
1535
+ }
1536
+ /**
1537
+ * Reconcile a run's process status with its recorded report. The child process
1538
+ * is normally authoritative, but wrappers can surface exit 0 even when the
1539
+ * report records unexpected failures. Escalate only zero exits so infra and
1540
+ * crash codes keep their original signal.
1541
+ */
1542
+ function reconcileExitCodeWithReport(exitCode, report) {
1543
+ if (exitCode !== 0 || !report) {
1544
+ return exitCode;
1545
+ }
1546
+ const unexpected = countUnexpectedTests(report);
1547
+ if (unexpected !== undefined && unexpected > 0) {
1548
+ Logger_1.appLogger.warn(`Run exited 0 but the report records ${unexpected} failed test(s); exiting non-zero.`);
1549
+ return 1;
1550
+ }
1551
+ return exitCode;
1514
1552
  }
1515
1553
  /**
1516
1554
  * Find a test entry in a report by title + project name. File paths are
@@ -2038,6 +2076,7 @@ async function runTestCommand(cliArgs) {
2038
2076
  // guarantee the reporter was deferring for.
2039
2077
  await postDeferredSlackFromInitialRun(playwrightOutputDir);
2040
2078
  }
2079
+ return reconcileExitCodeWithReport(autoHealOutcome.exitCode, enrichedInitialReport ?? initialDonobuReport);
2041
2080
  }
2042
2081
  return autoHealOutcome.exitCode;
2043
2082
  }
@@ -2268,5 +2307,6 @@ exports._forTesting = {
2268
2307
  ensureReporterValueHasJson,
2269
2308
  hasReporterArg,
2270
2309
  injectJsonReporterIntoArgs,
2310
+ reconcileExitCodeWithReport,
2271
2311
  };
2272
2312
  //# sourceMappingURL=donobu-cli.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "donobu",
3
- "version": "5.61.1",
3
+ "version": "5.61.3",
4
4
  "description": "Create browser automations with an LLM agent and replay them as Playwright scripts.",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/esm/main.js",