Skip to content

Run the Next.js adapter test suite for core and cloudflare - #53

Draft
conico974 wants to merge 21 commits into
mainfrom
conico974/next-test-suite
Draft

conico974 wants to merge 21 commits into
mainfrom
conico974/next-test-suite

Conversation

@conico974

@conico974 conico974 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Runs the Next.js adapter test suite against core and cloudflare, locally and in CI (AWS later). Also fixes three core bugs the suite surfaced.

pnpm next-suite run --target <core|cloudflare> [tests…]
  ensureNextCheckout(v16.2.1)            # clone + build vercel/next.js once
  packTarballs()                         # @opennextjs/* as published
  node run-tests.js                      # Next's harness, NEXT_TEST_MODE=deploy
    per test app:
      bin/e2e-deploy.sh                  # install tarballs, build, start on a free port
        core:       open-next build  → node .open-next/server-functions/default
        cloudflare: opennextjs-cloudflare build → wrangler dev
      bin/e2e-logs.sh                    # BUILD_ID / DEPLOYMENT_ID markers
      bin/e2e-cleanup.sh                 # kill the server's process group
packages/tests-next-suite/
├── disabled/core.json, cloudflare.json   # per-adapter disabled tests (file or exact case)
├── src/                                  # hooks, runner, edge detection, JUnit seeding
└── templates/                            # open-next.config / wrangler.jsonc per target
.github/workflows/next-suite.yml          # 16 groups × 2 targets: nightly, dispatch, PRs changing packages/
  • Disabling: { "test/e2e/x.test.ts": { "reason": "…", "cases": ["…"] } }, no cases disables the file. --include-disabled runs them anyway.
  • Edge runtime is not supported: pnpm next-suite disable-edge disables the 103 test files whose fixtures declare it.
  • cloudflare builds with webpack: its Turbopack chunk loader breaks outside a monorepo (not fixed here).

core fixes, each with a changeset:

 requestHandler.ts
+  globalThis.AsyncLocalStorage ??= AsyncLocalStorage   # apps without middleware crashed on first render

 adapterHandler.getHandler(route)
+  if route.type === "static" → serve inlined html     # pages router pages without data fetching 404'd

 imageLoader/fs-dev.ts
+  stat + isFile before createReadStream               # a missing image killed the local server

Evidence

Next.js 16.2.1, full local runs:

  • Before (no fixes, nothing disabled):
    core: 504 files run, 175 all pass, 1,588 cases fail (server crash on AsyncLocalStorage)
    cloudflare: 505 files run, 258 all pass, 1,285 cases fail
  • After (fixes, seeded lists):
    core: exit 0, 382 files, 1,444 cases pass, 0 fail
    cloudflare: 1,270 cases pass, one file failing 2 cases intermittently (5MB body, now disabled, re-run exit 0)
Disabled core cloudflare
Edge-runtime files 103 103
Other whole files 2 2
Cases (in files) 262 (112) 414 (127)
test/e2e/hello-world (pages/index.tsx, auto-static)
  before: GET / → 404 "Not Found", 4/4 fail on both adapters
  after:  4/4 pass on both adapters

CI on this PR (run): all 32 suite shards pass on both adapters with the lists, 8–23 min per shard. fmt, lint, ts:check, test pass.

Merge Danger

Door: two-way

Blast Radius: @opennextjs/core runtime

  • The core fixes ship to every adapter:
    • The AsyncLocalStorage global only fills a missing value.
    • Static pages add a route type and inline each page's HTML into every server bundle, which grows bundles on large i18n sites, and they have no ETag/304 yet.
  • .github/actions/setup gains a pnpm-cache input; the default is unchanged, and suite jobs disable it so unlocked npm installs can't write into the cache release jobs restore.
  • The suite now gates PRs touching packages/**: ~33 jobs, up to 3h each, and an adapter change that breaks an enabled test fails the check.

🤖 Generated with Claude Code

conico974 and others added 20 commits October 31, 2026 16:04
…gets

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Next.js sets it when next-server is loaded, which the adapter bundle does not do.
Apps without middleware crashed on their first render.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A test at the root of the e2e directory scanned every fixture, and a test file could disable its siblings.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The read stream emitted an error nothing listened to, which killed the server.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Next.js reports them as static files with no route to reach them, and the cache assets
skip them. Their content is inlined in the route dispatch as the runtime can not always
read from a filesystem.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Error pages under a base path or a locale were served as pages with a 200, the status
set by a rewrite was replaced, and nested index pages were mapped to the wrong route.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/opennextjs/adapters-api/@opennextjs/aws@7c42387
npm i https://pkg.pr.new/opennextjs/adapters-api/@opennextjs/cloudflare@7c42387
npm i https://pkg.pr.new/opennextjs/adapters-api/@opennextjs/core@7c42387

commit: 7c42387

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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