diff --git a/packages/test-utils/src/nuxt.ts b/packages/test-utils/src/nuxt.ts index e50aec398f..f6d267afd1 100644 --- a/packages/test-utils/src/nuxt.ts +++ b/packages/test-utils/src/nuxt.ts @@ -59,12 +59,14 @@ export async function loadFixture () { configFile: ctx.options.configFile }) - kit.logger.level = ctx.options.logLevel - await fsp.mkdir(ctx.nuxt.options.buildDir, { recursive: true }) } export async function buildFixture () { const ctx = useTestContext() + // Hide build info for test + const prevLevel = kit.logger.level + kit.logger.level = ctx.options.logLevel await kit.buildNuxt(ctx.nuxt!) + kit.logger.level = prevLevel } diff --git a/packages/test-utils/src/runtime/global-setup.ts b/packages/test-utils/src/runtime/global-setup.ts index 5dcfed3159..844671be5d 100644 --- a/packages/test-utils/src/runtime/global-setup.ts +++ b/packages/test-utils/src/runtime/global-setup.ts @@ -1,10 +1,17 @@ +import * as _kit from '@nuxt/kit' import { createTest, exposeContextToEnv } from '@nuxt/test-utils' -const hooks = createTest(JSON.parse(process.env.NUXT_TEST_OPTIONS || '{}')) +// @ts-ignore type cast +const kit: typeof _kit = _kit.default || _kit + +const options = JSON.parse(process.env.NUXT_TEST_OPTIONS || '{}') +const hooks = createTest(options) export const setup = async () => { + kit.logger.info('Building Nuxt app...') await hooks.setup() exposeContextToEnv() + kit.logger.info('Running tests...') } export const teardown = async () => {