mirror of
https://github.com/TanStack/router.git
synced 2026-11-16 19:38:07 +00:00
test(router-generator): route file upkeep through generate(), transform unit suite out of the corpus
Audit D H6: transform.test.ts drives the internal ../src/transform module with hand-built RouteNodes, so a rewrite with no user-visible difference fails it. It moves to tests/outside-compiler-corpus/transform.test.ts (header "Not part of the compiler test corpus"), and the route file upkeep it covers is re-expressed in tests/route-file-upkeep.test.ts through full generator runs, reading the file back and evaluating it: id fixed through cast options, double-quoted and template-literal ids, aliased Route export, export lists, a second non-exported route call, .ts angle-bracket assertions (#7341); root route files (createRootRoute, createRootRouteWithContext, export list) left byte for byte; constructor switches both ways (semicolon import, type specifier, multi-line import); the right constructor when the id is already right (5 rows); missing constructor import added on its own line (LF, CRLF, single line, next to another package's import, next to an aliased or a namespace import, semicolon style); type imports stay type-only; stale imports of the other constructor (CRLF, BOM + astral characters, trailing whitespace, same-line import, semicolons, untouched declaration, aliased constructor); Route re-exports / app route factories left as they are; ids the generator cannot rewrite and malformed route calls reported by file name (failed run, or a warning with the file untouched). Coordinator ruling on D ASK-1 (removing an unused import of the other route constructor is allowed, not required): every stale-import test, in the corpus file and in the moved unit suite (transform:203 CRLF, :625 BOM, :772 rows 2-4, :916, :932, :946, :984, :997), accepts the import kept or dropped, and always checks that the file evaluates, has the right id, binds the right constructor once and keeps its non-import code. Audit D rows applied to the moved unit suite: - transform:50 through parentheses: deleted (0 of ~50k corpus files wrap the constructor or the id in parentheses). - transform:511 redeclared `var Route` twice: deleted (0 corpus files with two `var Route = create...Route(` declarations). - transform:823 export-list helper `no-route-export`: deleted (internal result code); known-bugs "a route file without a Route export is left out with a warning" row 2 covers it through a run. - transform:829 `export let Route` without initializer: row dropped (0 corpus files); the Route-from-another-binding row stays. Not re-expressed in the corpus (kept in the unit suite only): the parenthesized call `((createFileRoute('/old'))({}))` and the multi-declarator export (0 corpus files each), the default import of the router package (the package has no default export), and two exported Route bindings (not a valid module). Also: literal BOM characters typed into generator-options.test.ts and the new file are written as escapes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0f9de68fcf
commit
a220a0579a
4 changed files with 1621 additions and 1011 deletions
Loading…
Add table
Add a link
Reference in a new issue