Skip to content

test: fix edge functions watch-ignore path assertions on Windows#8327

Merged
davbree merged 2 commits into
mainfrom
fix/watch-ignore-windows-test-paths
Jul 6, 2026
Merged

test: fix edge functions watch-ignore path assertions on Windows#8327
davbree merged 2 commits into
mainfrom
fix/watch-ignore-windows-test-paths

Conversation

@davbree

@davbree davbree commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Two related changes:

  1. Fix the failing Windows unit tests. 5 tests in tests/unit/lib/edge-functions/watch-ignore.test.ts hardcoded POSIX-style expected paths (e.g. /project/_site, /absolute/src/posts). The EdgeFunctionsRegistryImpl constructor normalizes publishDir/watchIgnore with path.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:

    AssertionError: expected 'D:\project\_site' to be '/project/_site'
    AssertionError: expected [ 'D:\project\src\posts', …(1) ] to deeply equal [ '/project/src/posts', …(1) ]
    

    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 to projectDir).

  2. 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 a macOS-latest and a windows-2025 job at the primary Node version to every PR's unit test matrix, via a new extra_oses_always key 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 on main — 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.
  • Simulated the updated matrix computation: regular PRs now include macOS-latest / 24 and windows-2025 / 24 on top of the always-on Linux coverage; release-please--* PRs include each exactly once (deduped).
  • With change (2) in place, this PR's own CI now runs the macOS and Windows unit jobs and validates the fix directly.

🤖 Generated with Claude Code

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>
@davbree davbree requested a review from a team as a code owner July 6, 2026 09:38
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change updates a unit test file to import resolve from the path module and modifies test assertions for constructor path resolution to compute expected publishDir and watchIgnore values dynamically using resolve('/project', ...), replacing previously hardcoded path string literals. No exported or public entity declarations were changed.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Changes

Cohort / File(s) Summary
Test path resolution update — tests/unit/lib/edge-functions/watch-ignore.test.ts Added resolve import; replaced hardcoded path literals with resolve('/project', ...)-derived values in constructor path-resolution assertions

Related issues: None specified.

Related PRs: None specified.

Suggested labels: tests, chore

Suggested reviewers: None specified.

🐰 A rabbit hopped through paths anew,
Swapped hardcoded strings for resolve's true view,
No more literal guesses on where things lay,
Just clean, cross-platform paths, come what may.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title accurately summarizes the primary change: fixing Windows path assertions in watch-ignore tests.
Description check ✅ Passed The description directly matches the changeset by explaining the test fix and CI matrix update.
✨ 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 fix/watch-ignore-windows-test-paths

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

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

📊 Benchmark results

Comparing with e6fbebc

  • Dependency count: 1,127 (no change)
  • Package size: 379 MB ⬆️ 0.00% increase vs. e6fbebc
  • Number of ts-expect-error directives: 359 (no change)

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>
@davbree davbree force-pushed the fix/watch-ignore-windows-test-paths branch from 86c044b to 19ffa89 Compare July 6, 2026 09:46
@davbree davbree merged commit 3c41e72 into main Jul 6, 2026
43 checks passed
@davbree davbree deleted the fix/watch-ignore-windows-test-paths branch July 6, 2026 12:48
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.

2 participants