diff --git a/packages/nuxt/src/core/nitro.ts b/packages/nuxt/src/core/nitro.ts index 2011c11b82..55dcf1a197 100644 --- a/packages/nuxt/src/core/nitro.ts +++ b/packages/nuxt/src/core/nitro.ts @@ -82,7 +82,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) { esbuild: { options: { exclude: excludePattern } }, - analyze: nuxt.options.build.analyze && (nuxt.options.build.analyze === true || nuxt.options.build.analyze.enabled) + analyze: !nuxt.options.test && nuxt.options.build.analyze && (nuxt.options.build.analyze === true || nuxt.options.build.analyze.enabled) ? { template: 'treemap', projectRoot: nuxt.options.rootDir, diff --git a/packages/vite/src/client.ts b/packages/vite/src/client.ts index fd45ed2d6a..f8c2982c71 100644 --- a/packages/vite/src/client.ts +++ b/packages/vite/src/client.ts @@ -130,12 +130,12 @@ export async function buildClient (ctx: ViteBuildContext) { } // Add analyze plugin if needed - if (ctx.nuxt.options.build.analyze && (ctx.nuxt.options.build.analyze === true || ctx.nuxt.options.build.analyze.enabled)) { + if (!ctx.nuxt.options.test && ctx.nuxt.options.build.analyze && (ctx.nuxt.options.build.analyze === true || ctx.nuxt.options.build.analyze.enabled)) { clientConfig.plugins!.push(...await import('./plugins/analyze').then(r => r.analyzePlugin(ctx))) } // Add type checking client panel - if (ctx.nuxt.options.typescript.typeCheck === true && ctx.nuxt.options.dev) { + if (!ctx.nuxt.options.test && ctx.nuxt.options.typescript.typeCheck === true && ctx.nuxt.options.dev) { clientConfig.plugins!.push(typeCheckPlugin({ sourcemap: !!ctx.nuxt.options.sourcemap.client })) } diff --git a/packages/vite/src/vite.ts b/packages/vite/src/vite.ts index a5fde9e1a5..23770d284d 100644 --- a/packages/vite/src/vite.ts +++ b/packages/vite/src/vite.ts @@ -140,7 +140,7 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => { } // Add type-checking - if (ctx.nuxt.options.typescript.typeCheck === true || (ctx.nuxt.options.typescript.typeCheck === 'build' && !ctx.nuxt.options.dev)) { + if (!ctx.nuxt.options.test && (ctx.nuxt.options.typescript.typeCheck === true || (ctx.nuxt.options.typescript.typeCheck === 'build' && !ctx.nuxt.options.dev))) { const checker = await import('vite-plugin-checker').then(r => r.default) addVitePlugin(checker({ vueTsc: { diff --git a/packages/webpack/src/configs/client.ts b/packages/webpack/src/configs/client.ts index c9aaee08d5..b4a36828eb 100644 --- a/packages/webpack/src/configs/client.ts +++ b/packages/webpack/src/configs/client.ts @@ -83,7 +83,7 @@ function clientOptimization (_ctx: WebpackConfigContext) { function clientPlugins (ctx: WebpackConfigContext) { // webpack Bundle Analyzer // https://github.com/webpack-contrib/webpack-bundle-analyzer - if (!ctx.isDev && ctx.name === 'client' && ctx.userConfig.analyze && (ctx.userConfig.analyze === true || ctx.userConfig.analyze.enabled)) { + if (!ctx.isDev && !ctx.nuxt.options.test && ctx.name === 'client' && ctx.userConfig.analyze && (ctx.userConfig.analyze === true || ctx.userConfig.analyze.enabled)) { const statsDir = resolve(ctx.options.analyzeDir) ctx.config.plugins!.push(new BundleAnalyzerPlugin({ @@ -100,7 +100,7 @@ function clientPlugins (ctx: WebpackConfigContext) { // Normally type checking runs in server config, but in `ssr: false` there is // no server build, so we inject here instead. if (!ctx.nuxt.options.ssr) { - if (ctx.nuxt.options.typescript.typeCheck === true || (ctx.nuxt.options.typescript.typeCheck === 'build' && !ctx.nuxt.options.dev)) { + if (!ctx.nuxt.options.test && (ctx.nuxt.options.typescript.typeCheck === true || (ctx.nuxt.options.typescript.typeCheck === 'build' && !ctx.nuxt.options.dev))) { ctx.config.plugins!.push(new ForkTSCheckerWebpackPlugin({ logger })) diff --git a/packages/webpack/src/configs/server.ts b/packages/webpack/src/configs/server.ts index 4ec087011b..265931c913 100644 --- a/packages/webpack/src/configs/server.ts +++ b/packages/webpack/src/configs/server.ts @@ -89,7 +89,7 @@ function serverPlugins (ctx: WebpackConfigContext) { } // Add type-checking - if (ctx.nuxt.options.typescript.typeCheck === true || (ctx.nuxt.options.typescript.typeCheck === 'build' && !ctx.nuxt.options.dev)) { + if (!ctx.nuxt.options.test && (ctx.nuxt.options.typescript.typeCheck === true || (ctx.nuxt.options.typescript.typeCheck === 'build' && !ctx.nuxt.options.dev))) { ctx.config.plugins!.push(new ForkTSCheckerWebpackPlugin({ logger }))