Skip to content

test(routing): isolate reserved-char param cases from Windows#2698

Open
MaxtuneLee wants to merge 2 commits into
cloudflare:mainfrom
MaxtuneLee:test/windows-routing-reserved-chars
Open

test(routing): isolate reserved-char param cases from Windows#2698
MaxtuneLee wants to merge 2 commits into
cloudflare:mainfrom
MaxtuneLee:test/windows-routing-reserved-chars

Conversation

@MaxtuneLee

@MaxtuneLee MaxtuneLee commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Related to #1792

Two Pages Router tests in tests/routing.test.ts build temp route fixtures whose param names contain characters that are reserved in Windows filenames (: and *). On Windows these fixtures either fail to create or silently create the wrong file, so the tests error out or assert against a route that was never discovered — making vp test run unrunnable locally on Windows even though the source under test is fine.

This PR splits each affected test so the valid-on-every-platform case (., +) keeps running everywhere, and the POSIX-only case (:, *) is gated with it.runIf(process.platform !== "win32"). No source/runtime code changes — this is a test-portability fix.

Root cause

Windows filenames may not contain < > : " / \ | ? *. Two of these show up in Pages Router route-param fixtures:

Fixture path Result on Windows Effect
[id*].tsx writeFile throws ENOENT / "The filename, directory name, or volume label syntax is incorrect" test errors before asserting
[repo:name].tsx : delimits an NTFS alternate data streamwriteFile succeeds but the directory listing shows only [repo, and the ADS name].tsx is invisible to readdir pagesRouter never discovers /repos/:repo:name, assertion fails

Changes

tests/routing.test.ts

  • Split "discovers dynamic segments with dots and colons" into a dots test (all platforms) and a colons test gated to POSIX.
  • Split "skips routes whose param names end in + or *" into a + test (all platforms) and a * test gated to POSIX.

Verification

Before (Windows):

FAIL tests/routing.test.ts > discovers dynamic segments with dots and colons
  AssertionError: expected [ '/products/:variant.id' ] to include '/repos/:repo:name'
FAIL tests/routing.test.ts > skips routes whose param names end in + or *
  Error: ENOENT: no such file or directory, open '...\pages\[id*].tsx'

After (Windows):

vp test run --project unit tests/routing.test.ts
Test Files  1 passed (1)
     Tests  122 passed | 2 skipped (124)

Test plan

  • vp test run --project unit tests/routing.test.ts (Windows) — green
  • vp check tests/routing.test.ts — format/lint/type clean
  • CI (Linux) runs the full suite, exercising the POSIX-only : and * cases

MaxtuneLee and others added 2 commits July 25, 2026 00:32
Two Pages Router tests build temp route fixtures whose param names use
characters reserved in Windows filenames: `[repo:name].tsx` (`:` opens an
NTFS alternate data stream, so pagesRouter never discovers the route) and
`[id*].tsx` (`*` makes writeFile throw). Both errored on `vp test run`
locally on Windows. Split each test so the valid-everywhere case (`.`, `+`)
runs on all platforms and the reserved-char case is gated with
`it.runIf(process.platform !== "win32")`. These scenarios are unreachable
on Windows in production too, so gating loses no coverage; POSIX CI still
exercises them.

Related to cloudflare#1792
@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vinext/cloudflare@2698
npm i https://pkg.pr.new/create-vinext-app@2698
npm i https://pkg.pr.new/@vinext/types@2698
npm i https://pkg.pr.new/vinext@2698

commit: fc19607

@github-actions

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared fc19607 against base 05eee9f using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 6 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 132.4 KB 132.4 KB ⚫ +0.0%
Client entry size (gzip) vinext 119.7 KB 119.7 KB ⚫ +0.0%
Dev server cold start vinext 2.35 s 2.36 s ⚫ +0.1%
Production build time vinext 2.44 s 2.44 s ⚫ -0.4%
RSC entry closure size (gzip) vinext 103.3 KB 103.3 KB ⚫ -0.0%
Server bundle size (gzip) vinext 177.8 KB 177.8 KB ⚫ -0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

@MaxtuneLee
MaxtuneLee marked this pull request as ready for review July 24, 2026 16:51
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