From eaa7e0a5ec71d7909b0b0199ffa21f89d8a8afce Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 8 Oct 2024 20:28:40 +0200 Subject: [PATCH] fix(e2e): set `NODE_ENV` when running built server (#969) --- src/core/context.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/context.ts b/src/core/context.ts index ff96c28c8..42c01dd1e 100644 --- a/src/core/context.ts +++ b/src/core/context.ts @@ -16,6 +16,7 @@ export function createTestContext(options: Partial): TestContext { logLevel: 1, server: true, build: (options.browser !== false) || (options.server !== false), + env: {}, nuxtConfig: { // suppress compatibility date warning for runtime environment tests compatibilityDate: '2024-04-03' as DateString, @@ -25,6 +26,10 @@ export function createTestContext(options: Partial): TestContext { }, } satisfies Partial) + if (!_options.dev) { + _options.env!.NODE_ENV ||= 'production' + } + // Disable build and server if endpoint is provided if (_options.host) { _options.build = false