From ca304f64ff1bee8f85466a2cba839731ca4a48e3 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Fri, 3 May 2024 10:46:30 +0200 Subject: [PATCH] add dev flag and fix test --- .../next/src/server/dev/hot-reloader-turbopack.ts | 6 +++--- test/e2e/middleware-general/test/index.test.ts | 13 +++++++------ .../middleware-trailing-slash/test/index.test.ts | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/next/src/server/dev/hot-reloader-turbopack.ts b/packages/next/src/server/dev/hot-reloader-turbopack.ts index d7b8b5d7a2851..f6409ae24184f 100644 --- a/packages/next/src/server/dev/hot-reloader-turbopack.ts +++ b/packages/next/src/server/dev/hot-reloader-turbopack.ts @@ -122,7 +122,7 @@ export async function createHotReloaderTurbopack( // of the current `next dev` invocation. hotReloaderSpan.stop() - const encryptionKey = await generateEncryptionKeyBase64() + const encryptionKey = await generateEncryptionKeyBase64(true) const project = await bindings.turbo.createProject({ projectPath: dir, rootPath: opts.nextConfig.experimental.outputFileTracingRoot || dir, @@ -143,7 +143,7 @@ export async function createHotReloaderTurbopack( // TODO: Implement middlewareMatchers: undefined, }), - buildId: 'development', + buildId, encryptionKey, previewProps: opts.fsChecker.prerenderManifest.preview, }) @@ -169,7 +169,7 @@ export async function createHotReloaderTurbopack( const manifestLoader = new TurbopackManifestLoader({ buildId, distDir, - encryptionKey: encryptionKey, + encryptionKey, }) // Dev specific diff --git a/test/e2e/middleware-general/test/index.test.ts b/test/e2e/middleware-general/test/index.test.ts index 95831f2cd67ca..c8100fc95952b 100644 --- a/test/e2e/middleware-general/test/index.test.ts +++ b/test/e2e/middleware-general/test/index.test.ts @@ -170,9 +170,9 @@ describe('Middleware Runtime', () => { ...manifest.middleware['/'], } const envs = { - ...middlewareWithoutEnvs.environments, + ...middlewareWithoutEnvs.env, } - delete middlewareWithoutEnvs.environments + delete middlewareWithoutEnvs.env expect(middlewareWithoutEnvs).toEqual({ files: expect.arrayContaining([ 'server/edge-runtime-webpack.js', @@ -186,10 +186,11 @@ describe('Middleware Runtime', () => { regions: 'auto', }) expect(envs).toContainAllKeys([ - 'buildId', - 'previewModeEncryptionKey', - 'previewModeId', - 'previewModeSigningKey', + 'NEXT_SERVER_ACTIONS_ENCRYPTION_KEY', + '__NEXT_BUILD_ID', + '__NEXT_PREVIEW_MODE_ENCRYPTION_KEY', + '__NEXT_PREVIEW_MODE_ID', + '__NEXT_PREVIEW_MODE_SIGNING_KEY', ]) }) diff --git a/test/e2e/middleware-trailing-slash/test/index.test.ts b/test/e2e/middleware-trailing-slash/test/index.test.ts index e6f04754930f3..1ee913f5a5578 100644 --- a/test/e2e/middleware-trailing-slash/test/index.test.ts +++ b/test/e2e/middleware-trailing-slash/test/index.test.ts @@ -112,7 +112,7 @@ describe('Middleware Runtime trailing slash', () => { const middlewareWithoutEnvs = { ...manifest.middleware['/'], } - delete middlewareWithoutEnvs.environments + delete middlewareWithoutEnvs.env expect(middlewareWithoutEnvs).toEqual({ files: expect.arrayContaining([ 'prerender-manifest.js',