UNPKG

@nuxt/test-utils

Version:
49 lines (46 loc) 1.4 kB
import defu from 'defu'; import { test as test$1 } from '@playwright/test'; export { expect } from '@playwright/test'; import { w as waitForHydration, d as createTest } from './shared/test-utils.BIDY1MqP.mjs'; import 'node:path'; import 'ufo'; import 'std-env'; import 'consola'; import 'node:fs'; import '@nuxt/kit'; import { d as url } from './shared/test-utils.CHPAu7TP.mjs'; import 'pathe'; import '#dirs'; import 'tinyexec'; import 'get-port-please'; import 'ofetch'; const test = test$1.extend({ nuxt: [void 0, { option: true, scope: "worker" }], defaults: [{ nuxt: void 0 }, { option: true, scope: "worker" }], _nuxtHooks: [ async ({ nuxt, defaults }, use) => { const hooks = createTest(defu(nuxt || {}, defaults.nuxt || {})); await hooks.setup(); await use(hooks); await hooks.afterAll(); }, { scope: "worker" } ], baseURL: async ({ _nuxtHooks }, use) => { _nuxtHooks.beforeEach(); await use(url("/")); _nuxtHooks.afterEach(); }, goto: async ({ page }, use) => { await use(async (url2, options) => { const waitUntil = options?.waitUntil; if (waitUntil && ["hydration", "route"].includes(waitUntil)) { delete options.waitUntil; } const response = await page.goto(url2, options); await waitForHydration(page, url2, waitUntil); return response; }); } }); export { test };