mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-23 00:50:05 +00:00
19 lines
539 B
TypeScript
19 lines
539 B
TypeScript
import type { TestHooks } from '../types'
|
|
|
|
export default async function setupJest (hooks: TestHooks) {
|
|
// @ts-ignore
|
|
const jest = await import('jest')
|
|
|
|
hooks.ctx.mockFn = jest.fn
|
|
|
|
// TODO: add globals existing check to provide better error message
|
|
// @ts-expect-error jest types
|
|
test('setup', hooks.setup, hooks.ctx.options.setupTimeout)
|
|
// @ts-expect-error jest types
|
|
beforeEach(hooks.beforeEach)
|
|
// @ts-expect-error jest types
|
|
afterEach(hooks.afterEach)
|
|
// @ts-expect-error jest types
|
|
afterAll(hooks.afterAll)
|
|
}
|