[PR #345] [MERGED] test: add snapshot tests for entry template generators #496

Closed
opened 2026-05-06 13:08:23 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/345
Author: @yunus25jmi1
Created: 3/8/2026
Status: Merged
Merged: 3/8/2026
Merged by: @james-elicx

Base: mainHead: test/entry-template-snapshots


📝 Commits (10+)

  • 1d6c140 test: add snapshot tests for entry template generators
  • 417323a Merge remote-tracking branch 'origin/main' into test/entry-template-snapshots
  • c706467 test: update entry template snapshots after merging main
  • 0f38e0f test: address bonk review comments on entry-template snapshot tests
  • ef3a5e6 Merge remote-tracking branch 'origin/main' into test/entry-template-snapshots
  • 44a2256 test: address new bonk review comments on entry-template snapshot tests
  • ad716e5 test: address final bonk review comments
  • 03b694d Merge remote-tracking branch 'upstream/main' into test/entry-template-snapshots
  • 08c8799 test: update snapshots after merge with main
  • 0926176 test: add metadata routes test, enrich route fixture with loading/error/template/notFound

📊 Changes

2 files changed (+17435 additions, -0 deletions)

View changed files

tests/__snapshots__/entry-templates.test.ts.snap (+17146 -0)
tests/entry-templates.test.ts (+289 -0)

📄 Description

Summary

Add snapshot tests for all 5 virtual entry module generators as a prerequisite for the incremental extraction in #253.

Per @james-elicx's feedback on #259: get snapshot tests in first, then perform each extraction separately so we have strong regression confidence.

Tests added (10 snapshots)

App Router (functions already exported from app-dev-server.ts):

  • generateRscEntry — minimal routes, with middleware, with config, with instrumentation, with global error, with metadata routes
  • generateSsrEntry
  • generateBrowserEntry

Pages Router (closures inside the plugin, tested via pluginContainer.load()):

  • virtual:vinext-server-entry
  • virtual:vinext-client-entry

Route fixture coverage

The minimalAppRoutes fixture includes:

  • Static routes (/, /about, /dashboard)
  • Dynamic route (/blog/:slug with isDynamic: true, params: ["slug"])
  • Rich route (/dashboard) with loadingPath, errorPath, layoutErrorPaths, notFoundPath, notFoundPaths, templates

Verification

  • Typecheck: pass
  • Lint: pass
  • Vitest: 10/10 snapshots written and passing

Addresses #253
Supersedes #259 (will be broken into incremental PRs after this lands)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/345 **Author:** [@yunus25jmi1](https://github.com/yunus25jmi1) **Created:** 3/8/2026 **Status:** ✅ Merged **Merged:** 3/8/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `test/entry-template-snapshots` --- ### 📝 Commits (10+) - [`1d6c140`](https://github.com/cloudflare/vinext/commit/1d6c140430a824e4e3c8d014523adbbc8058bf77) test: add snapshot tests for entry template generators - [`417323a`](https://github.com/cloudflare/vinext/commit/417323ad5974f3e53b514c29e621becd5549088b) Merge remote-tracking branch 'origin/main' into test/entry-template-snapshots - [`c706467`](https://github.com/cloudflare/vinext/commit/c706467db6b588bc7c91f6d9d3d8b8fe09d43bc8) test: update entry template snapshots after merging main - [`0f38e0f`](https://github.com/cloudflare/vinext/commit/0f38e0f3563a53e3e8f6be25635f3d402a03deb8) test: address bonk review comments on entry-template snapshot tests - [`ef3a5e6`](https://github.com/cloudflare/vinext/commit/ef3a5e6df1aab752b40dc8a7851dc5c38890ed7b) Merge remote-tracking branch 'origin/main' into test/entry-template-snapshots - [`44a2256`](https://github.com/cloudflare/vinext/commit/44a22562d6da9d4c01030e5672ca1f7f3c8714e6) test: address new bonk review comments on entry-template snapshot tests - [`ad716e5`](https://github.com/cloudflare/vinext/commit/ad716e53d093172897caafb683c3a720d7daf757) test: address final bonk review comments - [`03b694d`](https://github.com/cloudflare/vinext/commit/03b694d6791b8382846a591c7742c8c6f3e304c5) Merge remote-tracking branch 'upstream/main' into test/entry-template-snapshots - [`08c8799`](https://github.com/cloudflare/vinext/commit/08c8799e6ae2336f5ca8aa00fba01e0a9d866346) test: update snapshots after merge with main - [`0926176`](https://github.com/cloudflare/vinext/commit/0926176c679cb61d5f8c50c608eff5fda2fc332d) test: add metadata routes test, enrich route fixture with loading/error/template/notFound ### 📊 Changes **2 files changed** (+17435 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `tests/__snapshots__/entry-templates.test.ts.snap` (+17146 -0) ➕ `tests/entry-templates.test.ts` (+289 -0) </details> ### 📄 Description ## Summary Add snapshot tests for all 5 virtual entry module generators as a prerequisite for the incremental extraction in #253. Per @james-elicx's [feedback on #259](https://github.com/cloudflare/vinext/pull/259#issuecomment-2895025744): get snapshot tests in first, then perform each extraction separately so we have strong regression confidence. ### Tests added (10 snapshots) **App Router** (functions already exported from `app-dev-server.ts`): - `generateRscEntry` — minimal routes, with middleware, with config, with instrumentation, with global error, with metadata routes - `generateSsrEntry` - `generateBrowserEntry` **Pages Router** (closures inside the plugin, tested via `pluginContainer.load()`): - `virtual:vinext-server-entry` - `virtual:vinext-client-entry` ### Route fixture coverage The `minimalAppRoutes` fixture includes: - Static routes (`/`, `/about`, `/dashboard`) - Dynamic route (`/blog/:slug` with `isDynamic: true, params: ["slug"]`) - Rich route (`/dashboard`) with `loadingPath`, `errorPath`, `layoutErrorPaths`, `notFoundPath`, `notFoundPaths`, `templates` ### Verification - Typecheck: pass - Lint: pass - Vitest: 10/10 snapshots written and passing Addresses #253 Supersedes #259 (will be broken into incremental PRs after this lands) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:23 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#496
No description provided.