From 61f7cb32f4504c8ff27f5a4fa6384ebadfafb0ad Mon Sep 17 00:00:00 2001 From: Jacek Date: Wed, 15 Apr 2026 12:44:30 -0500 Subject: [PATCH 1/2] fix(integration): remove custom build script override in astro prod test --- integration/tests/astro/middleware.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/integration/tests/astro/middleware.test.ts b/integration/tests/astro/middleware.test.ts index fcf38560b3e..a7796ae842c 100644 --- a/integration/tests/astro/middleware.test.ts +++ b/integration/tests/astro/middleware.test.ts @@ -149,7 +149,6 @@ test.describe('custom middleware @astro (production build)', () => { app = await appConfigs.astro.node .clone() .setName('astro-custom-middleware-prod') - .addScript('build', 'pnpm astro build') .addFile('src/middleware.ts', middlewareFile) .addFile('src/pages/api/admin/[...action].ts', apiRouteFile) .commit(); From a365eea56a043898d177b251077f2c0fd78f3960 Mon Sep 17 00:00:00 2001 From: Jacek Date: Wed, 15 Apr 2026 13:43:28 -0500 Subject: [PATCH 2/2] fix(integration): override astro config and build script for prod test The template's default build script runs 'astro check && astro build', which validates config and fails on NaN port (PORT unset during build). Override with 'npx astro build' and provide a config with port fallback. --- integration/tests/astro/middleware.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/integration/tests/astro/middleware.test.ts b/integration/tests/astro/middleware.test.ts index a7796ae842c..bd4259d6155 100644 --- a/integration/tests/astro/middleware.test.ts +++ b/integration/tests/astro/middleware.test.ts @@ -22,6 +22,22 @@ export const GET: APIRoute = () => { }; `; +// The template's astro.config uses Number(process.env.PORT) which is NaN +// when PORT is unset (during build). Override with a fallback. +const astroConfigFile = () => `import { defineConfig } from 'astro/config'; +import node from '@astrojs/node'; +import clerk from '@clerk/astro'; +import react from '@astrojs/react'; +import tailwind from '@astrojs/tailwind'; + +export default defineConfig({ + output: 'server', + adapter: node({ mode: 'standalone' }), + integrations: [clerk(), react(), tailwind()], + server: { port: Number(process.env.PORT) || 4321 }, +}); +`; + test.describe('custom middleware @astro', () => { test.describe.configure({ mode: 'serial' }); let app: Application; @@ -149,6 +165,8 @@ test.describe('custom middleware @astro (production build)', () => { app = await appConfigs.astro.node .clone() .setName('astro-custom-middleware-prod') + .addScript('build', 'npx astro build') + .addFile('astro.config.mjs', astroConfigFile) .addFile('src/middleware.ts', middlewareFile) .addFile('src/pages/api/admin/[...action].ts', apiRouteFile) .commit();