Skip to content

test(core): automate dev-mode route rebuild via file watcher - #31

Merged
abdelkabirouadoukou merged 1 commit into
mainfrom
test/coverage-debt-cli-watcher
Aug 8, 2026
Merged

abdelkabirouadoukou merged 1 commit into
mainfrom
test/coverage-debt-cli-watcher

Conversation

@abdelkabirouadoukou

@abdelkabirouadoukou abdelkabirouadoukou commented Aug 8, 2026 •

Copy link
Copy Markdown
Member

Closes the last coverage-debt item that was only exercised manually: x dev
file watching / route rebuild.

Changes

  • New packages/core/src/createApp-watcher.test.ts — bootstraps a real
    dev-mode createApp against a fixture project, then:
    • adds a .tsx route file and asserts the debounced rebuild (200ms) serves
      the new route (SSR output verified),
    • removes it and asserts the route goes back to 404 while existing routes
      stay up.
      The fixture lives under __fixtures__/ and is cleaned up in afterAll.
  • ROADMAP: new "Dev server (file watching, route rebuild)" matrix row citing
    the test; CLI dev removed from the coverage-debt list.

Verification

  • bun run lint — clean
  • bun run typecheck — clean
  • bun test — 202 pass / 6 skip / 0 fail

Summary by CodeRabbit

  • Tests

    • Added automated coverage for development-mode route watching.
    • Verified that adding a route file makes the route available without restarting the server.
    • Verified that removing a route file restores a 404 response.
  • Documentation

    • Updated the API stability roadmap to reflect beta support and test coverage for development server file watching.

@vercel

vercel Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
thexjs-basic Ready Ready Preview Aug 8, 2026 6:20pm
x Ready Ready Preview Aug 8, 2026 6:20pm

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request adds an integration test for development-mode route watching. The test verifies route addition, serving, removal, and index-route preservation. The Changeset and roadmap record the new coverage and beta API stability status.

Changes

Dev route watcher coverage

Layer / File(s) Summary
Route watcher integration validation
packages/core/src/createApp-watcher.test.ts, .changeset/dev-route-watcher-tests.md, ROADMAP.md
The integration test uses isolated fixtures and polling to verify route-tree rebuilding after route addition and removal. The Changeset and roadmap record the automated coverage and beta status.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the automated core test for dev-mode route rebuilding through a file watcher.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/coverage-debt-cli-watcher

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/createApp-watcher.test.ts`:
- Around line 17-19: Update the fixture path constants used by the watcher tests
so every watched directory remains under FIXTURE_DIR: place PAGES_DIR two levels
below FIXTURE_DIR as required by the watcher’s primaryDir resolution, and derive
PROJECT_SRC_DIR from that fixture location rather than import.meta.dir. Preserve
the existing cleanup and watcher test behavior while preventing deletion of the
shared packages/core/src directory.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 90320754-e1ef-4231-8d3d-1ab518edc263

📥 Commits

Reviewing files that changed from the base of the PR and between f9301ad and e5cb7b4.

📒 Files selected for processing (3)
  • .changeset/dev-route-watcher-tests.md
  • ROADMAP.md
  • packages/core/src/createApp-watcher.test.ts

Comment on lines +17 to +19
const FIXTURE_DIR = join(import.meta.dir, "__fixtures__/watcher");
const PAGES_DIR = join(FIXTURE_DIR, "pages");
const PROJECT_SRC_DIR = join(import.meta.dir, "__fixtures__/src");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep all watched directories inside FIXTURE_DIR.

Line 18 makes primaryDir/../../src resolve to packages/core/src/__fixtures__/src. Line 42 and Line 56 then delete that shared directory. This can remove another test fixture or race with another test worker.

Place pages two levels below FIXTURE_DIR. Then the watcher resolves its src directory inside this test fixture.

Proposed fix
 const FIXTURE_DIR = join(import.meta.dir, "__fixtures__/watcher");
-const PAGES_DIR = join(FIXTURE_DIR, "pages");
-const PROJECT_SRC_DIR = join(import.meta.dir, "__fixtures__/src");
+const PAGES_DIR = join(FIXTURE_DIR, "app", "pages");
+const PROJECT_SRC_DIR = join(FIXTURE_DIR, "src");

 beforeAll(() => {
   rmSync(FIXTURE_DIR, { recursive: true, force: true });
-  rmSync(PROJECT_SRC_DIR, { recursive: true, force: true });
   mkdirSync(PAGES_DIR, { recursive: true });
   mkdirSync(PROJECT_SRC_DIR, { recursive: true });
 });

 afterAll(() => {
   rmSync(FIXTURE_DIR, { recursive: true, force: true });
-  rmSync(PROJECT_SRC_DIR, { recursive: true, force: true });
 });

Also applies to: 40-57

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/createApp-watcher.test.ts` around lines 17 - 19, Update the
fixture path constants used by the watcher tests so every watched directory
remains under FIXTURE_DIR: place PAGES_DIR two levels below FIXTURE_DIR as
required by the watcher’s primaryDir resolution, and derive PROJECT_SRC_DIR from
that fixture location rather than import.meta.dir. Preserve the existing cleanup
and watcher test behavior while preventing deletion of the shared
packages/core/src directory.

@abdelkabirouadoukou
abdelkabirouadoukou merged commit 5b6303e into main Aug 8, 2026
9 checks passed

This branch was successfully deployed

2 active deployments
Preview – thexjs-basic — e5cb7b42 Deployed Aug 8, 2026 by vercel[bot]
Preview – x — e5cb7b42 Deployed Aug 8, 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