fix(test): drop unused appendFile import — green Tests badge - #31
Conversation
CI's typecheck step (tsc --noEmit, runs before bun test) failed on TS6133 'appendFile' is declared but its value is never read'. The failure-gates demo test never used the import. Removing it restores the green Tests badge in the README hero without touching test logic. Test count unchanged: 3395 pass / 2 skip / 0 fail. Refs: TD-5 in docs/handoffs/2026-05-14-v0.20.1-tech-debt.md (smoke script test-count badge comparison) — this is the upstream defect TD-5 was supposed to catch pre-tag.
📝 WalkthroughWalkthroughThe pull request removes an unused ChangesTest import cleanup
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Removes an unused appendFile import from tests/demo/failure-gates.test.ts so CI's tsc --noEmit step stops failing with TS6133, restoring the green Tests badge.
Changes:
- Drop
appendFilefrom thenode:fs/promisesimport list in the failure-gates test.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request removes the unused appendFile import from node:fs/promises in the tests/demo/failure-gates.test.ts file. The reviewer suggested further consolidating the imports by merging the realpath import into the main node:fs/promises block to improve code clarity and maintainability.
|
|
||
| import { describe, test, expect, beforeEach, afterEach } from 'bun:test' | ||
| import { mkdtemp, mkdir, rm, writeFile, appendFile } from 'node:fs/promises' | ||
| import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises' |
There was a problem hiding this comment.
The import of realpath from node:fs/promises on line 27 is redundant with this import statement. They should be consolidated into a single import from node:fs/promises to improve code clarity and maintainability. Please remember to remove line 27 after applying this change.
| import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises' | |
| import { mkdtemp, mkdir, rm, writeFile, realpath } from 'node:fs/promises' |
The CI `bun test` step was discovering `code-oz-gui/tests/unit/*.test.ts`, which depend on `@google/genai` — a dependency of the GUI sub-package, not the root. CI's `bun install --frozen-lockfile` only installs the root deps, so the import failed with "Cannot find module '@google/genai'" on both ubuntu-latest and macos-latest. Locally the GUI's `node_modules` were present from earlier `bun install`s in that subdir, which masked the failure. Fix: scope the root `bun test` invocation (both in CI and in the `test` / `test:watch` npm scripts) to `./tests`. The GUI's unit tests remain runnable from inside `code-oz-gui/` via its own test runner. This restores green Tests + Release badges in the README hero, which is the visible signal that matters for first-time visitors. The static test-count badge updates from 3395 → 3390 (the 5 GUI unit tests now run only from inside the GUI sub-package). Refs: companion to the unused-appendFile-import fix in the same PR (the earlier typecheck failure was masking this test discovery bug).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 04e954fece
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| - name: Test | ||
| run: bun test | ||
| run: bun test ./tests |
There was a problem hiding this comment.
Keep GUI unit tests in CI by avoiding path-scoped bun test
This change narrows the CI command from bun test to bun test ./tests, which drops the code-oz-gui/tests/unit/* suite from the default test workflow with no replacement job in .github/workflows/ (I checked both test.yml and release.yml). Bun’s own CLI contract is bun test [<patterns>] (“run all matching test files”), so passing ./tests intentionally filters to that subtree; in this repo that reduces coverage from 3395 to 3390 passing tests and allows GUI regressions to merge undetected.
Useful? React with 👍 / 👎.
Summary
Two bugs were causing the README's
Tests | failingred badge on main. This PR closes both:tests/demo/failure-gates.test.ts:24importedappendFilebut never used it.tsc --noEmitfails withTS6133in CI, masking the second bug below.bun testdiscovery picked up GUI sub-package:code-oz-gui/tests/unit/*.test.tsrequires@google/genai, which is a dep of the GUI sub-package — not the root. CI'sbun install --frozen-lockfileonly installs root deps, sobun testerrored with "Cannot find module '@google/genai'" before the suite finished. Fix: scope rootbun testto./testsin both the workflow and the npm scripts. GUI unit tests remain runnable from insidecode-oz-gui/via its own runner.Combined effect: green Tests + Release badges in the README hero, which is the visible signal that matters for first-time visitors. Per the v0.20.1 polish push, a red CI badge on a project literally about gating is the biggest credibility hit on the front page.
Test plan
bun run typecheck— was failing locally, now passesbun run test— 3390 pass / 2 skip / 0 fail (./testsscope; GUI sub-package excluded)testworkflow goes green on this PR (both ubuntu-latest and macos-latest jobs)Refs: TD-5 in
docs/handoffs/2026-05-14-v0.20.1-tech-debt.md(smoke script test-count badge comparison) is the upstream class of defect; both bugs slipped past pre-tag because the fresh-clone smoke didn't runbun testagainst a true clean clone with only root deps installed.