Skip to content

test: add theme existence-check rethrow coverage (PR #51 review) - #53

Merged
ManningWorks merged 1 commit into
mainfrom
wt/t_2aecb61d
Oct 14, 2026
Merged

ManningWorks merged 1 commit into
mainfrom
wt/t_2aecb61d

Conversation

@ManningWorks

Copy link
Copy Markdown
Owner

What this does

Follow-up to the APPROVE review of PR 51 on ManningWorks/Projex (the issue #49 add non-TTY overwrite-prompt fix). Adds the missing test coverage — no production code changes, same shape as PR 50 on ManningWorks/Projex did for PR 48's review findings.

Findings addressed

MEDIUM — non-ENOENT rethrow branch in the theme existence check untested
The else { throw error } branch PR 51 added to addTheme's destination existence check (packages/core/src/commands/add.ts) had no coverage, while init's identical branch is tested (init.test.ts). The new case makes access from node:fs/promises resolve for the source-path check and reject with an EACCES-coded error for the destination existence check, and asserts add('theme-minimal', { force: false }) rejects with code: 'EACCES' without writing (copyFile never called) and without process.exit.

LOW — theme-path rethrows surface as unhandled rejections at CLI level
Not addressed in this PR (out of scope: test-coverage only). Filed as issue #52 on ManningWorks/Projex: the rethrow propagates out of addTheme with no catch at the call site and no top-level handler in cli.ts — identical to the approved init baseline, so it is a cross-command concern.

Verification

  • Full gate green: pnpm install && pnpm build && pnpm typecheck && pnpm lint && pnpm test (1052 core tests pass).
  • Mutation-checked the new test: it fails when the rethrow branch is reverted to swallowing the error and passes when restored.
  • Target file: pnpm --dir packages/core exec vitest run src/commands/__tests__/add.test.ts → 13 passed.

@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
projex-docs Ready Ready Preview Oct 14, 2026 10:58am UTC

@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d71e9e5a-2459-47da-89f4-56c517c62ac3
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ManningWorks

Copy link
Copy Markdown
Owner Author

Reviewer verdict: APPROVE — zero findings (no CRITICAL/HIGH/MEDIUM/LOW).

Reviewed PR 53 on ManningWorks/Projex (head d694d05, 1 commit on wt/t_2aecb61d) against merge-base 9f264e1 (= origin/main tip; branch not behind).

Scope guard holds: exactly 1 file (packages/core/src/commands/tests/add.test.ts, +29/-0), test-only. No production code change, no version bump, no tag.

Spec check (PR 51 MEDIUM finding follow-up):

  • New test 'surfaces a non-ENOENT existence-check error instead of writing' is present and mirrors the init.test.ts:181 shape: access resolves for the source-path check, rejects with an EACCES-coded error for the destination existence check, and asserts add('theme-minimal', { force: false }) rejects with code EACCES, without copyFile and without process.exit.
  • Mock path filter verified against addTheme (add.ts:297-320): source path (.../themes/theme-minimal.css) resolves; destination path (.../styles/projex-theme-minimal.css) throws EACCES, which isNotFoundError does not match (strict code === 'ENOENT'), driving the else { throw error } branch.
  • Style matches the sibling non-TTY tests in the same describe block (failOnExit / logSpy / restore; vi.mocked dynamic-import pattern).
  • The LOW finding (theme-path rethrows surface as unhandled rejections at CLI level) is intentionally out of scope; confirmed filed as issue 52 on ManningWorks/Projex (open, title matches) and referenced from the PR body.

Gate evidence spot-check: CI all checks green on head d694d05 (Build, Lint, Type Check, Test). Re-ran the targeted file locally on the PR-head worktree: pnpm --dir packages/core exec vitest run src/commands/tests/add.test.ts → 13/13 pass, consistent with the PR body. Parent's mutation check (test fails when the rethrow branch is reverted to swallow) is consistent with the code reading.

Verdict: APPROVE. Not merging — merge is Luke's call.

@ManningWorks
ManningWorks merged commit 5359508 into main Oct 14, 2026
7 checks passed

This branch was successfully deployed

1 active deployment
Preview — d694d05d Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant