Repository navigation
test(core): automate dev-mode route rebuild via file watcher - #31
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe 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. ChangesDev route watcher coverage
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
0bcf81e to
c09afb4
Compare
c09afb4 to
e5cb7b4
Compare
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
.changeset/dev-route-watcher-tests.mdROADMAP.mdpackages/core/src/createApp-watcher.test.ts
| 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"); |
There was a problem hiding this comment.
🗄️ 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.
Closes the last coverage-debt item that was only exercised manually:
x devfile watching / route rebuild.
Changes
packages/core/src/createApp-watcher.test.ts— bootstraps a realdev-mode
createAppagainst a fixture project, then:.tsxroute file and asserts the debounced rebuild (200ms) servesthe new route (SSR output verified),
404while existing routesstay up.
The fixture lives under
__fixtures__/and is cleaned up inafterAll.the test;
CLI devremoved from the coverage-debt list.Verification
bun run lint— cleanbun run typecheck— cleanbun test— 202 pass / 6 skip / 0 failSummary by CodeRabbit
Tests
Documentation