@nuxt/test-utils 3.21.0 → 3.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/dist/config.d.mts +3 -3
  3. package/dist/config.mjs +40 -21
  4. package/dist/e2e.d.mts +3 -2
  5. package/dist/e2e.mjs +17 -13
  6. package/dist/experimental.mjs +1 -1
  7. package/dist/module.mjs +721 -148
  8. package/dist/playwright.d.mts +2 -1
  9. package/dist/playwright.mjs +3 -3
  10. package/dist/runtime/shared/environment.mjs +11 -66
  11. package/dist/runtime/shared/h3-v1.d.ts +6 -0
  12. package/dist/runtime/shared/h3-v1.mjs +69 -0
  13. package/dist/runtime/shared/h3-v2.d.ts +6 -0
  14. package/dist/runtime/shared/h3-v2.mjs +35 -0
  15. package/dist/runtime/shared/h3.d.ts +3 -0
  16. package/dist/runtime/shared/h3.mjs +3 -0
  17. package/dist/runtime/shared/nuxt.d.ts +1 -1
  18. package/dist/runtime/shared/nuxt.mjs +10 -2
  19. package/dist/runtime/shared/vue-wrapper-plugin.d.ts +50 -0
  20. package/dist/runtime/shared/vue-wrapper-plugin.mjs +41 -0
  21. package/dist/runtime-utils/index.d.mts +26 -25
  22. package/dist/runtime-utils/index.mjs +185 -272
  23. package/dist/shared/{test-utils.3NR-so9-.mjs → test-utils.5cnw0YZR.mjs} +2 -2
  24. package/dist/shared/{test-utils.G1ew4kEe.mjs → test-utils.BIY9XRkB.mjs} +1 -1
  25. package/dist/shared/{test-utils.CtwoJP76.mjs → test-utils.BsmyE2FA.mjs} +10 -8
  26. package/dist/shared/{test-utils.20kU0tZa.d.mts → test-utils.C9GKP_T5.d.mts} +3 -2
  27. package/dist/shared/test-utils.DDUpsMYL.mjs +32 -0
  28. package/dist/vitest-environment.d.mts +15 -3
  29. package/dist/vitest-environment.mjs +118 -66
  30. package/dist/vitest-wrapper/cli.d.mts +2 -0
  31. package/dist/vitest-wrapper/cli.mjs +78 -0
  32. package/package.json +32 -26
@@ -1,9 +1,10 @@
1
1
  import * as _playwright_test from '@playwright/test';
2
2
  export { expect } from '@playwright/test';
3
3
  import { Response } from 'playwright-core';
4
- import { T as TestOptions$1, G as GotoOptions, b as TestHooks } from './shared/test-utils.20kU0tZa.mjs';
4
+ import { T as TestOptions$1, G as GotoOptions, a as TestHooks } from './shared/test-utils.C9GKP_T5.mjs';
5
5
  import '@nuxt/schema';
6
6
  import 'tinyexec';
7
+ import 'ofetch';
7
8
 
8
9
  type ConfigOptions = {
9
10
  nuxt: Partial<TestOptions$1> | undefined;
@@ -1,7 +1,7 @@
1
1
  import defu from 'defu';
2
2
  import { test as test$1 } from '@playwright/test';
3
3
  export { expect } from '@playwright/test';
4
- import { w as waitForHydration, d as createTest } from './shared/test-utils.3NR-so9-.mjs';
4
+ import { w as waitForHydration, d as createTest } from './shared/test-utils.5cnw0YZR.mjs';
5
5
  import 'node:path';
6
6
  import 'ufo';
7
7
  import 'std-env';
@@ -11,10 +11,10 @@ import 'destr';
11
11
  import 'scule';
12
12
  import 'node:url';
13
13
  import 'exsolve';
14
- import { d as url } from './shared/test-utils.CtwoJP76.mjs';
14
+ import { d as url } from './shared/test-utils.BsmyE2FA.mjs';
15
15
  import 'pathe';
16
16
  import '#dirs';
17
- import './shared/test-utils.G1ew4kEe.mjs';
17
+ import './shared/test-utils.BIY9XRkB.mjs';
18
18
  import 'tinyexec';
19
19
  import 'get-port-please';
20
20
  import 'ofetch';
@@ -1,8 +1,9 @@
1
1
  import { createFetch } from "ofetch";
2
2
  import { joinURL } from "ufo";
3
- import { createApp, defineEventHandler, toNodeListener } from "h3";
3
+ import { defineEventHandler } from "./h3.mjs";
4
4
  import { createRouter as createRadixRouter, exportMatcher, toRouteMatcher } from "radix3";
5
- import { fetchNodeRequestHandler } from "node-mock-http";
5
+ import { createFetchForH3V1 } from "./h3-v1.mjs";
6
+ import { createFetchForH3V2 } from "./h3-v2.mjs";
6
7
  export async function setupWindow(win, environmentOptions) {
7
8
  win.__NUXT_VITEST_ENVIRONMENT__ = true;
8
9
  win.__NUXT__ = {
@@ -35,7 +36,6 @@ export async function setupWindow(win, environmentOptions) {
35
36
  const app = win.document.createElement("div");
36
37
  app.id = rootId;
37
38
  win.document.body.appendChild(app);
38
- const h3App = createApp();
39
39
  if (!win.fetch || !("Request" in win)) {
40
40
  await import("node-fetch-native/polyfill");
41
41
  win.URLSearchParams = globalThis.URLSearchParams;
@@ -49,37 +49,11 @@ export async function setupWindow(win, environmentOptions) {
49
49
  }
50
50
  };
51
51
  }
52
- const nodeHandler = toNodeListener(h3App);
53
- const registry = /* @__PURE__ */ new Set();
54
- const _fetch = fetch;
55
- win.fetch = async (input, _init) => {
56
- let url;
57
- let init = _init;
58
- if (typeof input === "string") {
59
- url = input;
60
- } else if (input instanceof URL) {
61
- url = input.toString();
62
- } else {
63
- url = input.url;
64
- init = {
65
- method: init?.method ?? input.method,
66
- body: init?.body ?? input.body,
67
- headers: init?.headers ?? input.headers
68
- };
69
- }
70
- const base = url.split("?")[0];
71
- if (registry.has(base) || registry.has(url)) {
72
- url = "/_" + url;
73
- }
74
- if (url.startsWith("/")) {
75
- const response = await fetchNodeRequestHandler(nodeHandler, url, init);
76
- return normalizeFetchResponse(response);
77
- }
78
- return _fetch(input, _init);
79
- };
52
+ const res = environmentOptions.nuxt.h3Version === 2 ? await createFetchForH3V2() : await createFetchForH3V1();
53
+ win.fetch = res.fetch;
80
54
  win.$fetch = createFetch({ fetch: win.fetch, Headers: win.Headers });
81
- win.__registry = registry;
82
- win.__app = h3App;
55
+ win.__registry = res.registry;
56
+ win.__app = res.h3App;
83
57
  const timestamp = Date.now();
84
58
  const routeRulesMatcher = toRouteMatcher(
85
59
  createRadixRouter({ routes: environmentOptions.nuxtRouteRules || {} })
@@ -92,14 +66,14 @@ export async function setupWindow(win, environmentOptions) {
92
66
  );
93
67
  const manifestBaseRoutePath = joinURL("/_", manifestOutputPath);
94
68
  const buildId = win.__NUXT__.config?.app.buildId || "test";
95
- h3App.use(
69
+ res.h3App.use(
96
70
  `${manifestBaseRoutePath}/latest.json`,
97
71
  defineEventHandler(() => ({
98
72
  id: buildId,
99
73
  timestamp
100
74
  }))
101
75
  );
102
- h3App.use(
76
+ res.h3App.use(
103
77
  `${manifestBaseRoutePath}/meta/${buildId}.json`,
104
78
  defineEventHandler(() => ({
105
79
  id: buildId,
@@ -108,38 +82,9 @@ export async function setupWindow(win, environmentOptions) {
108
82
  prerendered: []
109
83
  }))
110
84
  );
111
- registry.add(`${manifestOutputPath}/latest.json`);
112
- registry.add(`${manifestOutputPath}/meta/${buildId}.json`);
85
+ res.registry.add(`${manifestOutputPath}/latest.json`);
86
+ res.registry.add(`${manifestOutputPath}/meta/${buildId}.json`);
113
87
  return () => {
114
88
  console.info = consoleInfo;
115
89
  };
116
90
  }
117
- function normalizeFetchResponse(response) {
118
- if (!response.headers.has("set-cookie")) {
119
- return response;
120
- }
121
- return new Response(response.body, {
122
- status: response.status,
123
- statusText: response.statusText,
124
- headers: normalizeCookieHeaders(response.headers)
125
- });
126
- }
127
- function normalizeCookieHeader(header = "") {
128
- return splitCookiesString(joinHeaders(header));
129
- }
130
- function normalizeCookieHeaders(headers) {
131
- const outgoingHeaders = new Headers();
132
- for (const [name, header] of headers) {
133
- if (name === "set-cookie") {
134
- for (const cookie of normalizeCookieHeader(header)) {
135
- outgoingHeaders.append("set-cookie", cookie);
136
- }
137
- } else {
138
- outgoingHeaders.set(name, joinHeaders(header));
139
- }
140
- }
141
- return outgoingHeaders;
142
- }
143
- function joinHeaders(value) {
144
- return Array.isArray(value) ? value.join(", ") : String(value);
145
- }
@@ -0,0 +1,6 @@
1
+ import type { GenericApp } from '../../vitest-environment';
2
+ export declare function createFetchForH3V1(): Promise<{
3
+ h3App: GenericApp;
4
+ registry: Set<string>;
5
+ fetch: typeof fetch;
6
+ }>;
@@ -0,0 +1,69 @@
1
+ export async function createFetchForH3V1() {
2
+ const [{ createApp, toNodeListener }, { fetchNodeRequestHandler }] = await Promise.all([
3
+ import("h3"),
4
+ import("node-mock-http")
5
+ ]);
6
+ const h3App = createApp();
7
+ const nodeHandler = toNodeListener(h3App);
8
+ const registry = /* @__PURE__ */ new Set();
9
+ const _fetch = fetch;
10
+ const h3Fetch = (async (input, _init) => {
11
+ let url;
12
+ let init = _init;
13
+ if (typeof input === "string") {
14
+ url = input;
15
+ } else if (input instanceof URL) {
16
+ url = input.toString();
17
+ } else {
18
+ url = input.url;
19
+ init = {
20
+ method: init?.method ?? input.method,
21
+ body: init?.body ?? input.body,
22
+ headers: init?.headers ?? input.headers
23
+ };
24
+ }
25
+ const base = url.split("?")[0];
26
+ if (registry.has(base) || registry.has(url)) {
27
+ url = "/_" + url;
28
+ }
29
+ if (url.startsWith("/")) {
30
+ const response = await fetchNodeRequestHandler(nodeHandler, url, init);
31
+ return normalizeFetchResponse(response);
32
+ }
33
+ return _fetch(input, _init);
34
+ });
35
+ return {
36
+ h3App,
37
+ registry,
38
+ fetch: h3Fetch
39
+ };
40
+ }
41
+ function normalizeFetchResponse(response) {
42
+ if (!response.headers.has("set-cookie")) {
43
+ return response;
44
+ }
45
+ return new Response(response.body, {
46
+ status: response.status,
47
+ statusText: response.statusText,
48
+ headers: normalizeCookieHeaders(response.headers)
49
+ });
50
+ }
51
+ function normalizeCookieHeader(header = "") {
52
+ return splitCookiesString(joinHeaders(header));
53
+ }
54
+ function normalizeCookieHeaders(headers) {
55
+ const outgoingHeaders = new Headers();
56
+ for (const [name, header] of headers) {
57
+ if (name === "set-cookie") {
58
+ for (const cookie of normalizeCookieHeader(header)) {
59
+ outgoingHeaders.append("set-cookie", cookie);
60
+ }
61
+ } else {
62
+ outgoingHeaders.set(name, joinHeaders(header));
63
+ }
64
+ }
65
+ return outgoingHeaders;
66
+ }
67
+ function joinHeaders(value) {
68
+ return Array.isArray(value) ? value.join(", ") : String(value);
69
+ }
@@ -0,0 +1,6 @@
1
+ import type { GenericApp } from '../../vitest-environment';
2
+ export declare function createFetchForH3V2(): Promise<{
3
+ h3App: GenericApp;
4
+ registry: Set<string>;
5
+ fetch: typeof fetch;
6
+ }>;
@@ -0,0 +1,35 @@
1
+ export async function createFetchForH3V2() {
2
+ const { H3 } = await import("h3-next/generic");
3
+ const h3App = new H3();
4
+ const registry = /* @__PURE__ */ new Set();
5
+ const _fetch = fetch;
6
+ const h3Fetch = (async (input, _init) => {
7
+ let url;
8
+ let init = _init;
9
+ if (typeof input === "string") {
10
+ url = input;
11
+ } else if (input instanceof URL) {
12
+ url = input.toString();
13
+ } else {
14
+ url = input.url;
15
+ init = {
16
+ method: init?.method ?? input.method,
17
+ body: init?.body ?? input.body,
18
+ headers: init?.headers ?? input.headers
19
+ };
20
+ }
21
+ const base = url.split("?")[0];
22
+ if (registry.has(base) || registry.has(url)) {
23
+ return h3App.fetch(new Request("/_" + url, init));
24
+ }
25
+ if (url.startsWith("/")) {
26
+ return new Response("Not Found", { status: 404, statusText: "Not Found" });
27
+ }
28
+ return _fetch(input, _init);
29
+ });
30
+ return {
31
+ h3App,
32
+ registry,
33
+ fetch: h3Fetch
34
+ };
35
+ }
@@ -0,0 +1,3 @@
1
+ type RawHandler = () => unknown | Promise<unknown>;
2
+ export declare function defineEventHandler(handler: RawHandler): RawHandler;
3
+ export {};
@@ -0,0 +1,3 @@
1
+ export function defineEventHandler(handler) {
2
+ return Object.assign(handler, { __is_handler__: true });
3
+ }
@@ -1 +1 @@
1
- export declare function setupNuxt(): Promise<void>;
1
+ export declare function setupNuxt(): Promise<any>;
@@ -1,7 +1,15 @@
1
+ import { getVueWrapperPlugin } from "./vue-wrapper-plugin.mjs";
1
2
  export async function setupNuxt() {
2
3
  const { useRouter } = await import("#app/composables/router");
3
4
  await import("#app/nuxt-vitest-app-entry").then((r) => r.default());
4
5
  const nuxtApp = useNuxtApp();
5
- await nuxtApp.callHook("page:finish");
6
- useRouter().afterEach(() => nuxtApp.callHook("page:finish"));
6
+ function sync() {
7
+ return nuxtApp._route.sync ? nuxtApp._route.sync() : nuxtApp.callHook("page:finish");
8
+ }
9
+ const { hasNuxtPage } = getVueWrapperPlugin();
10
+ useRouter().afterEach(() => {
11
+ if (hasNuxtPage()) return;
12
+ return sync();
13
+ });
14
+ return sync();
7
15
  }
@@ -0,0 +1,50 @@
1
+ import type { VueWrapper } from '@vue/test-utils';
2
+ type Options = ReturnType<typeof createPluginOptions>;
3
+ export declare function getVueWrapperPlugin(): Options;
4
+ declare function createPluginOptions(): {
5
+ _name: string;
6
+ _instances: WeakRef<VueWrapper>[];
7
+ readonly instances: VueWrapper<unknown, {
8
+ $: import("vue").ComponentInternalInstance;
9
+ $data: {};
10
+ $props: {};
11
+ $attrs: {
12
+ [x: string]: unknown;
13
+ };
14
+ $refs: {
15
+ [x: string]: unknown;
16
+ };
17
+ $slots: Readonly<{
18
+ [name: string]: import("vue").Slot<any> | undefined;
19
+ }>;
20
+ $root: import("vue").ComponentPublicInstance | null;
21
+ $parent: import("vue").ComponentPublicInstance | null;
22
+ $host: Element | null;
23
+ $emit: (event: string, ...args: any[]) => void;
24
+ $el: any;
25
+ $options: import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}, {}, {}, string, import("vue").ComponentProvideOptions> & {
26
+ beforeCreate?: (() => void) | (() => void)[];
27
+ created?: (() => void) | (() => void)[];
28
+ beforeMount?: (() => void) | (() => void)[];
29
+ mounted?: (() => void) | (() => void)[];
30
+ beforeUpdate?: (() => void) | (() => void)[];
31
+ updated?: (() => void) | (() => void)[];
32
+ activated?: (() => void) | (() => void)[];
33
+ deactivated?: (() => void) | (() => void)[];
34
+ beforeDestroy?: (() => void) | (() => void)[];
35
+ beforeUnmount?: (() => void) | (() => void)[];
36
+ destroyed?: (() => void) | (() => void)[];
37
+ unmounted?: (() => void) | (() => void)[];
38
+ renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
39
+ renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
40
+ errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
41
+ };
42
+ $forceUpdate: () => void;
43
+ $nextTick: typeof import("vue").nextTick;
44
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
45
+ } & Readonly<{}> & Omit<{}, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {}>[];
46
+ addInstance(instance: VueWrapper): void;
47
+ hasNuxtPage(): boolean;
48
+ _hasComponent(componentName: string): boolean;
49
+ };
50
+ export {};
@@ -0,0 +1,41 @@
1
+ import { config } from "@vue/test-utils";
2
+ const PLUGIN_NAME = "nuxt-test-utils";
3
+ export function getVueWrapperPlugin() {
4
+ const installed = config.plugins.VueWrapper.installedPlugins.find(({ options: options2 }) => options2._name === PLUGIN_NAME);
5
+ if (installed) return installed.options;
6
+ const options = createPluginOptions();
7
+ config.plugins.VueWrapper.install((instance, options2) => {
8
+ options2.addInstance(instance);
9
+ return {};
10
+ }, options);
11
+ return options;
12
+ }
13
+ function createPluginOptions() {
14
+ const options = {
15
+ _name: PLUGIN_NAME,
16
+ _instances: [],
17
+ get instances() {
18
+ const instances = [];
19
+ options._instances = options._instances.filter((ref) => {
20
+ const instance = ref.deref();
21
+ if (!instance) return false;
22
+ instances.push(instance);
23
+ return true;
24
+ });
25
+ return instances;
26
+ },
27
+ addInstance(instance) {
28
+ if (options.instances.includes(instance)) return;
29
+ options._instances.push(new WeakRef(instance));
30
+ },
31
+ hasNuxtPage() {
32
+ return options._hasComponent("NuxtPage");
33
+ },
34
+ _hasComponent(componentName) {
35
+ return options.instances.some(
36
+ (v) => v.exists() && v.findComponent({ name: componentName }).exists()
37
+ );
38
+ }
39
+ };
40
+ return options;
41
+ }
@@ -1,8 +1,9 @@
1
- import { EventHandler, HTTPMethod } from 'h3';
1
+ import { EventHandler } from 'h3';
2
+ import { HTTPMethod } from 'h3-next';
2
3
  import { SetupContext, RenderFunction, ComputedOptions, MethodOptions, ComponentOptionsMixin, EmitsOptions, ComponentInjectOptions, ComponentOptionsWithoutProps, ComponentOptionsWithArrayProps, ComponentPropsOptions, ComponentOptionsWithObjectProps } from 'vue';
3
- import { ComponentMountingOptions, mount } from '@vue/test-utils';
4
+ import { mount } from '@vue/test-utils';
4
5
  import { RouteLocationRaw } from 'vue-router';
5
- import { RenderOptions, RenderResult } from '@testing-library/vue';
6
+ import { render } from '@testing-library/vue';
6
7
 
7
8
  type Awaitable<T> = T | Promise<T>;
8
9
  type OptionalFunction<T> = T | (() => Awaitable<T>);
@@ -95,14 +96,26 @@ declare function mockComponent<Props = {}, RawBindings = {}, D = {}, C extends C
95
96
  declare function mockComponent<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string>(path: string, options: OptionalFunction<ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II>>): void;
96
97
  declare function mockComponent<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string>(path: string, options: OptionalFunction<ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II>>): void;
97
98
 
98
- type MountSuspendedOptions<T> = ComponentMountingOptions<T> & {
99
- route?: RouteLocationRaw;
99
+ type SetupState = Record<string, any>;
100
+ type WrapperFnComponent<Fn> = Fn extends (c: infer C, o: infer _) => infer _ ? C : never;
101
+ type WrapperFnOption<Fn> = Fn extends (c: WrapperFnComponent<Fn>, o: infer O) => infer _ ? O : never;
102
+ type WrapperFnResult<Fn> = Fn extends (c: WrapperFnComponent<Fn>, o: WrapperFnOption<Fn>) => infer R ? R : never;
103
+ type WrapperSuspendedOptions<Fn> = WrapperFnOption<Fn> & {
104
+ route?: RouteLocationRaw | false;
100
105
  scoped?: boolean;
101
106
  };
102
- type MountSuspendedResult<T> = ReturnType<typeof mount<T>> & {
103
- setupState: SetupState$1;
107
+ type WrapperSuspendedResult<Fn> = WrapperFnResult<Fn> & {
108
+ setupState: SetupState;
104
109
  };
105
- type SetupState$1 = Record<string, any>;
110
+ declare global {
111
+ interface Window {
112
+ __cleanup?: Array<() => void>;
113
+ }
114
+ }
115
+
116
+ type WrapperFn$1<C> = typeof mount<C>;
117
+ type WrapperOptions$1<C> = WrapperSuspendedOptions<WrapperFn$1<C>>;
118
+ type WrapperResult$1<C> = WrapperSuspendedResult<WrapperFn$1<C>>;
106
119
  /**
107
120
  * `mountSuspended` allows you to mount any vue component within the Nuxt environment, allowing async setup and access to injections from your Nuxt plugins. For example:
108
121
  *
@@ -129,18 +142,11 @@ type SetupState$1 = Record<string, any>;
129
142
  * @param component the component to be tested
130
143
  * @param options optional options to set up your component
131
144
  */
132
- declare function mountSuspended<T>(component: T, options?: MountSuspendedOptions<T>): Promise<MountSuspendedResult<T>>;
133
- declare global {
134
- var __cleanup: Array<() => void> | undefined;
135
- }
145
+ declare function mountSuspended<T>(component: T, options?: WrapperOptions$1<T>): Promise<WrapperResult$1<T>>;
136
146
 
137
- type RenderSuspendeOptions<T> = RenderOptions<T> & {
138
- route?: RouteLocationRaw;
139
- };
140
- type RenderSuspendeResult = RenderResult & {
141
- setupState: SetupState;
142
- };
143
- type SetupState = Record<string, any>;
147
+ type WrapperFn<C> = typeof render<C>;
148
+ type WrapperOptions<C> = WrapperSuspendedOptions<WrapperFn<C>>;
149
+ type WrapperResult<C> = WrapperSuspendedResult<WrapperFn<C>>;
144
150
  /**
145
151
  * `renderSuspended` allows you to mount any vue component within the Nuxt environment, allowing async setup and access to injections from your Nuxt plugins.
146
152
  *
@@ -171,11 +177,6 @@ type SetupState = Record<string, any>;
171
177
  * @param component the component to be tested
172
178
  * @param options optional options to set up your component
173
179
  */
174
- declare function renderSuspended<T>(component: T, options?: RenderSuspendeOptions<T>): Promise<RenderSuspendeResult>;
175
- declare global {
176
- interface Window {
177
- __cleanup?: Array<() => void>;
178
- }
179
- }
180
+ declare function renderSuspended<T>(component: T, options?: WrapperOptions<T>): Promise<WrapperResult<T>>;
180
181
 
181
182
  export { mockComponent, mockNuxtImport, mountSuspended, registerEndpoint, renderSuspended };