test: fix edge functions watch-ignore path assertions on Windows#8327
Conversation
The constructor path resolution tests hardcoded POSIX-style expected paths (e.g. `/project/_site`), but the registry normalizes paths with `path.resolve`, which on Windows yields drive-prefixed, backslash paths (e.g. `D:\project\_site`). Compute the expected values with the same `resolve` call so the assertions hold on every platform. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis change updates a unit test file to import Estimated code review effort: 1 (Trivial) | ~5 minutes Changes
Related issues: None specified. Related PRs: None specified. Suggested labels: tests, chore Suggested reviewers: None specified. 🐰 A rabbit hopped through paths anew, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Since #8199, macOS/Windows only ran on release-please PRs, so regressions in unit tests (like the watch-ignore path assertions) slipped through until the release PR. Add macOS and Windows jobs at the primary Node version to every PR's unit test matrix via a new `extra_oses_always` list, deduplicating against the release-only OS set so release PRs don't get duplicate jobs. Integration and E2E matrices are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
86c044b to
19ffa89
Compare
Summary
Two related changes:
Fix the failing Windows unit tests. 5 tests in
tests/unit/lib/edge-functions/watch-ignore.test.tshardcoded POSIX-style expected paths (e.g./project/_site,/absolute/src/posts). TheEdgeFunctionsRegistryImplconstructor normalizespublishDir/watchIgnorewithpath.resolve(projectDir, …)(src/lib/edge-functions/registry.ts:179-180), which on Windows produces drive-prefixed, backslash paths (D:\project\_site), so the assertions could only pass on macOS/Linux:Fixed by computing the expected values with the same
resolve('/project', …)call the implementation uses, so the assertions hold on every platform while still verifying the meaningful behavior (inputs resolved relative toprojectDir).Run unit tests on macOS and Windows for every PR. Since chore: optimize CI #8199, macOS/Windows test jobs only run on
release-please--*PRs and the nightly schedule — which is exactly why this regression wasn't caught until it surfaced on the release PR (chore(main): release 26.2.0 #8290). This adds amacOS-latestand awindows-2025job at the primary Node version to every PR's unit test matrix, via a newextra_oses_alwayskey in.github/test-matrix.yml, deduplicated against the release-only OS set so release PRs don't get duplicate jobs. Integration and E2E matrices are unchanged (they remain release/schedule-gated).Context
The broken tests were introduced in #8271 (
feat: add watch-ignore flag), so this failure already exists onmain— it's not specific to the release PR (#8290) that surfaced it. Once this merges, #8290 goes green on re-run.Verification
npm exec vitest -- run tests/unit/lib/edge-functions/watch-ignore.test.ts→ 14 passed locally.macOS-latest / 24andwindows-2025 / 24on top of the always-on Linux coverage;release-please--*PRs include each exactly once (deduped).🤖 Generated with Claude Code