[PR #686] [MERGED] test: add static export E2E tests (#564) #770

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/686
Author: @raed04
Created: 3/25/2026
Status: Merged
Merged: 3/28/2026
Merged by: @james-elicx

Base: mainHead: feat/issue-564-static-export-e2e


📝 Commits (2)

  • 7bd8a0a test: add static export E2E tests (#564)
  • eafaeba Update tests/e2e/static-export/serve-static.mjs

📊 Changes

5 files changed (+309 additions, -0 deletions)

View changed files

📝 .github/workflows/ci.yml (+1 -0)
📝 playwright.config.ts (+15 -0)
tests/e2e/static-export/app-router.spec.ts (+84 -0)
tests/e2e/static-export/pages-router.spec.ts (+66 -0)
tests/e2e/static-export/serve-static.mjs (+143 -0)

📄 Description

Summary

  • Add Playwright E2E tests for output: "export" static builds covering both App Router and Pages Router
  • Add a lightweight static file server (serve-static.mjs) with path traversal protection, proper error handling, and startup validation
  • Wire up the static-export project in playwright.config.ts and the CI matrix

Details

New files

  • tests/e2e/static-export/app-router.spec.ts — 10 tests covering home, about, blog slugs, navigation, metadata, and 404 handling
  • tests/e2e/static-export/pages-router.spec.ts — 7 tests covering Pages Router pages, getStaticProps/getStaticPaths data, __NEXT_DATA__ verification, and 404 for non-pre-rendered routes
  • tests/e2e/static-export/serve-static.mjs — Zero-dependency static file server with:
    • Path traversal protection (URL normalization + resolve + prefix check)
    • Narrowed error handling (ENOENT/ENOTDIR/ERR_INVALID_ARG_VALUE only, real errors propagate)
    • Startup validation (port range, root directory existence + isDirectory check)
    • server.on("error") handler for EADDRINUSE
    • Top-level request try-catch preventing unhandled rejections

Modified files

  • playwright.config.ts — New static-export project entry (port 4180, 60s timeout)
  • .github/workflows/ci.yml — Add static-export to E2E matrix

Test plan

  • All 17 static-export E2E tests pass locally
  • Full CI suite passes locally: unit tests, integration tests, and all 4 non-cloudflare E2E projects (356 total E2E tests, 0 failures)
  • vp check (formatting + types) passes
  • No regressions in existing test suites

🔄 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/686 **Author:** [@raed04](https://github.com/raed04) **Created:** 3/25/2026 **Status:** ✅ Merged **Merged:** 3/28/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `feat/issue-564-static-export-e2e` --- ### 📝 Commits (2) - [`7bd8a0a`](https://github.com/cloudflare/vinext/commit/7bd8a0a54eff6b9a8c43a048b0937cd860267dd4) test: add static export E2E tests (#564) - [`eafaeba`](https://github.com/cloudflare/vinext/commit/eafaebacaea87142f696e7b4c04e4bc070e2742e) Update tests/e2e/static-export/serve-static.mjs ### 📊 Changes **5 files changed** (+309 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+1 -0) 📝 `playwright.config.ts` (+15 -0) ➕ `tests/e2e/static-export/app-router.spec.ts` (+84 -0) ➕ `tests/e2e/static-export/pages-router.spec.ts` (+66 -0) ➕ `tests/e2e/static-export/serve-static.mjs` (+143 -0) </details> ### 📄 Description ## Summary - Add Playwright E2E tests for `output: "export"` static builds covering both App Router and Pages Router - Add a lightweight static file server (`serve-static.mjs`) with path traversal protection, proper error handling, and startup validation - Wire up the `static-export` project in `playwright.config.ts` and the CI matrix ## Details ### New files - **`tests/e2e/static-export/app-router.spec.ts`** — 10 tests covering home, about, blog slugs, navigation, metadata, and 404 handling - **`tests/e2e/static-export/pages-router.spec.ts`** — 7 tests covering Pages Router pages, `getStaticProps`/`getStaticPaths` data, `__NEXT_DATA__` verification, and 404 for non-pre-rendered routes - **`tests/e2e/static-export/serve-static.mjs`** — Zero-dependency static file server with: - Path traversal protection (URL normalization + resolve + prefix check) - Narrowed error handling (ENOENT/ENOTDIR/ERR_INVALID_ARG_VALUE only, real errors propagate) - Startup validation (port range, root directory existence + isDirectory check) - `server.on("error")` handler for EADDRINUSE - Top-level request try-catch preventing unhandled rejections ### Modified files - **`playwright.config.ts`** — New `static-export` project entry (port 4180, 60s timeout) - **`.github/workflows/ci.yml`** — Add `static-export` to E2E matrix ## Test plan - [x] All 17 static-export E2E tests pass locally - [x] Full CI suite passes locally: unit tests, integration tests, and all 4 non-cloudflare E2E projects (356 total E2E tests, 0 failures) - [x] `vp check` (formatting + types) passes - [x] No regressions in existing test suites --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:10:01 +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#770
No description provided.