diff --git a/CHANGELOG.md b/CHANGELOG.md index 00643f0a4f..2e6be28923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ ### πŸ”§ Bug Fixes - **tests(cli):** stabilize `setup-claude.test.ts` (#5959) β€” the dry-run path printed a multi-byte "──" heading to the test child's stdout, corrupting the node:test runner's V8-serialized event stream in ~50% of runs ("Unable to deserialize cloned data due to invalid or unsupported version") and randomly failing the PRβ†’release queue. `syncClaudeProfilesFromModels` now accepts an injectable `log` sink (CLI default unchanged: `console.log`); the test injects a collector and gains assertions on the dry-run report. Validated 0/30 failures post-fix vs 5/10 on the pristine base. +- **tests(cli):** deflake `cli-setup-opencode.test.ts` preemptively β€” same #5959 class: the command under test prints multi-byte "βœ”"/"βœ–" CLI glyphs to the test child's stdout, which can corrupt the node:test V8 report stream. Console silenced for the file (pattern of #6019/#6021); no test asserts on stdout. 0/20 failures, stdout clean. - **tests(ci):** collect the orphaned `tests/unit/executors/` directory (created by #5800 outside every runner glob β€” its 2 test files never ran anywhere). Added `executors` to the unit-runner brace globs (package.json, ci.yml shards, quality.yml TIA, test-impact map, test-discovery gate); both files pass (10/10). ### πŸ“ Maintenance diff --git a/tests/unit/cli-setup-opencode.test.ts b/tests/unit/cli-setup-opencode.test.ts index 714e901db8..ca5425e9d5 100644 --- a/tests/unit/cli-setup-opencode.test.ts +++ b/tests/unit/cli-setup-opencode.test.ts @@ -40,12 +40,27 @@ function readConfig() { return JSON.parse(fs.readFileSync(path.join(CONFIG_DIR, "opencode.json"), "utf8")); } +// #5959-class deflake: the command under test prints CLI progress with multi-byte +// glyphs (printInfo/printSuccess "βœ”"/printError "βœ–" via console.log). Under the +// node:test runner those stdout writes interleave with the child's V8-serialized +// report frames and can corrupt the stream ("Unable to deserialize cloned data +// due to invalid or unsupported version"). No test here asserts on stdout, so +// silence the stdout-writing console methods for the duration of this file +// (same pattern as tests/unit/cli/setup-claude.test.ts, #6019/#6021). +const _console = { log: console.log, info: console.info, warn: console.warn }; + describe("omniroute setup opencode", () => { before(() => { + console.log = () => {}; + console.info = () => {}; + console.warn = () => {}; makeFakePluginDist(); }); after(() => { + console.log = _console.log; + console.info = _console.info; + console.warn = _console.warn; try { fs.rmSync(FIXTURE_ROOT, { recursive: true, force: true }); } catch { @@ -72,7 +87,11 @@ describe("omniroute setup opencode", () => { const [modulePath, options] = cfg.plugin[0]; assert.equal(modulePath, "./plugins/omniroute/dist/index.js"); assert.equal(options.providerId, "omniroute"); - assert.equal(options.baseURL, "http://10.0.0.5:20128", "--base-url flag must reach the registered entry"); + assert.equal( + options.baseURL, + "http://10.0.0.5:20128", + "--base-url flag must reach the registered entry" + ); }); it("is idempotent: re-running updates the entry in place instead of duplicating it", async () => { @@ -85,10 +104,15 @@ describe("omniroute setup opencode", () => { const cfg = readConfig(); const omniEntries = cfg.plugin.filter( - (p: unknown) => Array.isArray(p) && (p[1] as { providerId?: string })?.providerId === "omniroute" + (p: unknown) => + Array.isArray(p) && (p[1] as { providerId?: string })?.providerId === "omniroute" ); assert.equal(omniEntries.length, 1, "re-run must not duplicate the entry"); - assert.equal(omniEntries[0][1].baseURL, "http://10.0.0.9:20128", "re-run updates baseURL in place"); + assert.equal( + omniEntries[0][1].baseURL, + "http://10.0.0.9:20128", + "re-run updates baseURL in place" + ); }); it("removes the legacy opencode-omniroute-auth entry (#3711) and preserves unrelated plugins", async () => {