From 591f4305b8d7250a5d97a7905d6550f3ad44abd4 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 20 Oct 2023 16:52:37 +0100 Subject: [PATCH] fix(nuxt,schema): use `std-env` to detect whether app is being tested (#23830) --- packages/nuxt/src/core/nitro.ts | 2 +- packages/schema/src/config/common.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nuxt/src/core/nitro.ts b/packages/nuxt/src/core/nitro.ts index 9ca59458e1..bd9161666e 100644 --- a/packages/nuxt/src/core/nitro.ts +++ b/packages/nuxt/src/core/nitro.ts @@ -215,7 +215,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) { if (nuxt.options.experimental.appManifest) { // @ts-expect-error untyped nuxt property const buildId = nuxt.options.appConfig.nuxt!.buildId ||= - (nuxt.options.test ? 'test' : nuxt.options.dev ? 'dev' : randomUUID()) + (nuxt.options.dev ? 'dev' : nuxt.options.test ? 'test' : randomUUID()) const buildTimestamp = Date.now() const manifestPrefix = joinURL(nuxt.options.app.buildAssetsDir, 'builds') diff --git a/packages/schema/src/config/common.ts b/packages/schema/src/config/common.ts index 9f934cfb13..013a1da6fb 100644 --- a/packages/schema/src/config/common.ts +++ b/packages/schema/src/config/common.ts @@ -1,6 +1,6 @@ import { defineUntypedSchema } from 'untyped' import { join, relative, resolve } from 'pathe' -import { isDebug, isDevelopment } from 'std-env' +import { isDebug, isDevelopment, isTest } from 'std-env' import { defu } from 'defu' import { findWorkspaceDir } from 'pkg-types' import type { RuntimeConfig } from '../types/config' @@ -158,7 +158,7 @@ export default defineUntypedSchema({ /** * Whether your app is being unit tested. */ - test: Boolean(isDevelopment), + test: Boolean(isTest), /** * Set to `true` to enable debug mode.