Commit efb93662 authored by Will Binns-Smith's avatar Will Binns-Smith

Fix CI failures: await computeCacheBustingSearchParam and update url test

- Add missing `await` for async `computeCacheBustingSearchParam` call in
  cache-components test (TypeScript error TS2345)
- Update url.test.ts to reflect that Turbopack now uses a single shared
  server chunking context for all endpoints (SSR, API routes, metadata),
  so `new URL()` assets consistently output to `_next/static/media/`
  rather than `server/assets/` for API/metadata routes
parent 01c6e0b3
...@@ -439,7 +439,7 @@ describe('cache-components', () => { ...@@ -439,7 +439,7 @@ describe('cache-components', () => {
const stateTree = JSON.stringify(['', {}]) const stateTree = JSON.stringify(['', {}])
const requestUrl = new URL('/cases/static', `http://localhost:${port}`) const requestUrl = new URL('/cases/static', `http://localhost:${port}`)
const cacheBustingParam = computeCacheBustingSearchParam( const cacheBustingParam = await computeCacheBustingSearchParam(
undefined, undefined,
undefined, undefined,
stateTree, stateTree,
......
...@@ -3,13 +3,16 @@ import { isNextDev, isNextStart, nextTestSetup } from 'e2e-utils' ...@@ -3,13 +3,16 @@ import { isNextDev, isNextStart, nextTestSetup } from 'e2e-utils'
// | | Pages Client | Pages Server (SSR,RSC) | API Routes/Middleware/Metadata | // | | Pages Client | Pages Server (SSR,RSC) | API Routes/Middleware/Metadata |
// |---------|-------------------------|-------------------------|--------------------------------| // |---------|-------------------------|-------------------------|--------------------------------|
// | new URL | /_next/static/media/... | /_next/static/media/... | /server/assets/... | // | new URL | /_next/static/media/... | /_next/static/media/... | /_next/static/media/... |
// | import | /_next/static/media/... | /_next/static/media/... | /_next/static/media/... | // | import | /_next/static/media/... | /_next/static/media/... | /_next/static/media/... |
// |---------|-------------------------|-------------------------|--------------------------------| // |---------|-------------------------|-------------------------|--------------------------------|
// //
// Webpack has // Webpack has
// - a bug where App Router API routes (and Metadata) return client assets for `new URL`s. // - a bug where App Router API routes (and Metadata) return client assets for `new URL`s.
// - a bug where Edge Page routes return client assets for `new URL`s. // - a bug where Edge Page routes return client assets for `new URL`s.
//
// Turbopack uses a single shared Node.js chunking context for all server endpoints (SSR pages,
// API routes, metadata routes), so `new URL` assets all go to `_next/static/media/`.
describe(`Handle new URL asset references`, () => { describe(`Handle new URL asset references`, () => {
const { next, skipped, isTurbopack } = nextTestSetup({ const { next, skipped, isTurbopack } = nextTestSetup({
files: __dirname, files: __dirname,
...@@ -25,9 +28,13 @@ describe(`Handle new URL asset references`, () => { ...@@ -25,9 +28,13 @@ describe(`Handle new URL asset references`, () => {
return return
} }
const serverFileRegex = expect.stringMatching( const serverFileRegex = isTurbopack
/file:.*\/.next(\/dev)?\/server\/.*\/vercel.HASH.png$/ ? expect.stringMatching(
) /file:.*\/.next(\/dev)?\/static\/media\/vercel.HASH.png$/
)
: expect.stringMatching(
/file:.*\/.next(\/dev)?\/server\/.*\/vercel.HASH.png$/
)
const serverEdgeUrl = isTurbopack const serverEdgeUrl = isTurbopack
? `blob:server/edge/assets/vercel.HASH.png` ? `blob:server/edge/assets/vercel.HASH.png`
: `blob:vercel.HASH.png` : `blob:vercel.HASH.png`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment