Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(isolation): orphan_ratio doctor helper clears the CLI exit verdict it sets; edge-proposals --json resets it before each test

garrytana368400578a7
diff --git a/test/edge-proposals-json-bigint.test.ts b/test/edge-proposals-json-bigint.test.ts
index a18ea94779..4d21f9c2d6 100644
--- a/test/edge-proposals-json-bigint.test.ts
+++ b/test/edge-proposals-json-bigint.test.ts
@@ -3,7 +3,7 @@
* returns BigInt ids (Postgres `bigint` columns). The CLI normalizes ids at
* the row boundary: a safe integer becomes a number, anything larger a string.
*/
-import { afterEach, describe, expect, spyOn, test } from 'bun:test';
+import { afterEach, beforeEach, describe, expect, spyOn, test } from 'bun:test';
import { runEdgeProposals } from '../src/commands/edge-proposals.ts';
import { _resetCliExitVerdictForTests, currentExitCode } from '../src/core/cli-force-exit.ts';
import type { BrainEngine } from '../src/core/engine.ts';
@@ -34,6 +34,7 @@ async function capture(engine: BrainEngine, args: string[]): Promise<string> {
return lines.join('\n');
}
+beforeEach(() => { _resetCliExitVerdictForTests(); process.exitCode = 0; });
afterEach(() => { _resetCliExitVerdictForTests(); process.exitCode = 0; });
describe('#6193 edge-proposals --json with BigInt ids', () => {
diff --git a/test/orphan-ratio-connector-renders.test.ts b/test/orphan-ratio-connector-renders.test.ts
index f354a13c7d..963b8c41d6 100644
--- a/test/orphan-ratio-connector-renders.test.ts
+++ b/test/orphan-ratio-connector-renders.test.ts
@@ -12,6 +12,7 @@ import { resetPgliteState } from './helpers/reset-pglite.ts';
import { findOrphans } from '../src/commands/orphans.ts';
import { runDoctor, type DoctorReport } from '../src/commands/doctor.ts';
import { setCliOptions } from '../src/core/cli-options.ts';
+import { _resetCliExitVerdictForTests } from '../src/core/cli-force-exit.ts';
let engine: PGLiteEngine;
@@ -56,6 +57,8 @@ async function doctorCheck(args: string[]) {
if (!(e instanceof Error && e.message === '__exit')) throw e;
} finally {
console.log = log; console.error = err; (process as { exit: unknown }).exit = exit;
+ _resetCliExitVerdictForTests();
+ process.exitCode = 0;
}
for (let i = out.length - 1; i >= 0; i--) {
try {