Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(test-utils): do not hide vitest output (#9442)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu authored Dec 2, 2022
1 parent 0b6f37f commit 3501fd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/test-utils/src/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
9 changes: 8 additions & 1 deletion packages/test-utils/src/runtime/global-setup.ts
Original file line number Diff line number Diff line change
@@ -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 () => {
Expand Down

0 comments on commit 3501fd5

Please sign in to comment.