2022-12-02 09:42:23 +00:00
|
|
|
import * as _kit from '@nuxt/kit'
|
2022-11-10 14:55:47 +00:00
|
|
|
import { createTest, exposeContextToEnv } from '@nuxt/test-utils'
|
|
|
|
|
2022-12-02 09:42:23 +00:00
|
|
|
// @ts-ignore type cast
|
|
|
|
const kit: typeof _kit = _kit.default || _kit
|
|
|
|
|
|
|
|
const options = JSON.parse(process.env.NUXT_TEST_OPTIONS || '{}')
|
|
|
|
const hooks = createTest(options)
|
2022-11-10 14:55:47 +00:00
|
|
|
|
|
|
|
export const setup = async () => {
|
2022-12-02 09:42:23 +00:00
|
|
|
kit.logger.info('Building Nuxt app...')
|
2022-11-10 14:55:47 +00:00
|
|
|
await hooks.setup()
|
|
|
|
exposeContextToEnv()
|
2022-12-02 09:42:23 +00:00
|
|
|
kit.logger.info('Running tests...')
|
2022-11-10 14:55:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const teardown = async () => {
|
|
|
|
await hooks.afterAll()
|
|
|
|
}
|