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