fix(nuxt,schema): use std-env to detect whether app is being tested (#23830)

This commit is contained in:
Daniel Roe 2023-10-20 16:52:37 +01:00 committed by GitHub
parent ffa6b6e60c
commit 591f4305b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -215,7 +215,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
if (nuxt.options.experimental.appManifest) { if (nuxt.options.experimental.appManifest) {
// @ts-expect-error untyped nuxt property // @ts-expect-error untyped nuxt property
const buildId = nuxt.options.appConfig.nuxt!.buildId ||= 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 buildTimestamp = Date.now()
const manifestPrefix = joinURL(nuxt.options.app.buildAssetsDir, 'builds') const manifestPrefix = joinURL(nuxt.options.app.buildAssetsDir, 'builds')

View File

@ -1,6 +1,6 @@
import { defineUntypedSchema } from 'untyped' import { defineUntypedSchema } from 'untyped'
import { join, relative, resolve } from 'pathe' import { join, relative, resolve } from 'pathe'
import { isDebug, isDevelopment } from 'std-env' import { isDebug, isDevelopment, isTest } from 'std-env'
import { defu } from 'defu' import { defu } from 'defu'
import { findWorkspaceDir } from 'pkg-types' import { findWorkspaceDir } from 'pkg-types'
import type { RuntimeConfig } from '../types/config' import type { RuntimeConfig } from '../types/config'
@ -158,7 +158,7 @@ export default defineUntypedSchema({
/** /**
* Whether your app is being unit tested. * Whether your app is being unit tested.
*/ */
test: Boolean(isDevelopment), test: Boolean(isTest),
/** /**
* Set to `true` to enable debug mode. * Set to `true` to enable debug mode.