@nuxt/test-utils 3.14.1 → 3.14.3
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.
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +1 -0
- package/dist/e2e.d.mts +3 -3
- package/dist/e2e.d.ts +3 -3
- package/dist/e2e.mjs +5 -5
- package/dist/experimental.mjs +2 -2
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.mjs +1 -1
- package/dist/playwright.d.mts +2 -2
- package/dist/playwright.d.ts +2 -2
- package/dist/playwright.mjs +3 -3
- package/dist/runtime/nuxt-root.d.ts +1 -1
- package/dist/runtime-utils/index.mjs +36 -2
- package/dist/shared/{test-utils.CyoO8zI7.d.mts → test-utils.C0h0-xb8.d.mts} +2 -2
- package/dist/shared/{test-utils.CyoO8zI7.d.ts → test-utils.C0h0-xb8.d.ts} +2 -2
- package/dist/shared/{test-utils.BZS9cHDP.mjs → test-utils.CaqvQLs_.mjs} +1 -1
- package/dist/shared/{test-utils.BumFEtZ8.mjs → test-utils.ClQ9CUdo.mjs} +34 -26
- package/dist/vitest-environment.d.mts +2 -1
- package/dist/vitest-environment.d.ts +2 -1
- package/dist/vitest-environment.mjs +4 -1
- package/package.json +39 -39
package/dist/config.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { InlineConfig } from 'vite';
|
|
3
3
|
import { NuxtConfig, Nuxt } from '@nuxt/schema';
|
|
4
|
-
import { InlineConfig as InlineConfig$1 } from 'vitest';
|
|
4
|
+
import { InlineConfig as InlineConfig$1 } from 'vitest/node';
|
|
5
5
|
import { DotenvOptions } from 'c12';
|
|
6
6
|
|
|
7
7
|
interface GetVitestConfigOptions {
|
package/dist/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { InlineConfig } from 'vite';
|
|
3
3
|
import { NuxtConfig, Nuxt } from '@nuxt/schema';
|
|
4
|
-
import { InlineConfig as InlineConfig$1 } from 'vitest';
|
|
4
|
+
import { InlineConfig as InlineConfig$1 } from 'vitest/node';
|
|
5
5
|
import { DotenvOptions } from 'c12';
|
|
6
6
|
|
|
7
7
|
interface GetVitestConfigOptions {
|
package/dist/config.mjs
CHANGED
|
@@ -81,6 +81,7 @@ async function startNuxtAndGetViteConfig(rootDir = process.cwd(), options = {})
|
|
|
81
81
|
}
|
|
82
82
|
const excludedPlugins = [
|
|
83
83
|
"nuxt:import-protection",
|
|
84
|
+
"nuxt:import-conditions",
|
|
84
85
|
"vite-plugin-checker"
|
|
85
86
|
];
|
|
86
87
|
async function getVitestConfigFromNuxt(options, loadNuxtOptions = {}) {
|
package/dist/e2e.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { T as TestOptions, a as TestContext, b as TestHooks } from './shared/test-utils.
|
|
2
|
-
export { $ as $fetch, G as GotoOptions, S as StartServerOptions, h as TestRunner, c as createBrowser, d as createPage, f as fetch, g as getBrowser, s as startServer, e as stopServer, u as url, w as waitForHydration } from './shared/test-utils.
|
|
1
|
+
import { T as TestOptions, a as TestContext, b as TestHooks } from './shared/test-utils.C0h0-xb8.mjs';
|
|
2
|
+
export { $ as $fetch, G as GotoOptions, S as StartServerOptions, h as TestRunner, c as createBrowser, d as createPage, f as fetch, g as getBrowser, s as startServer, e as stopServer, u as url, w as waitForHydration } from './shared/test-utils.C0h0-xb8.mjs';
|
|
3
3
|
import { LogType } from 'consola';
|
|
4
4
|
import 'playwright-core';
|
|
5
5
|
import '@nuxt/schema';
|
|
6
|
-
import '
|
|
6
|
+
import 'tinyexec';
|
|
7
7
|
|
|
8
8
|
declare function createTestContext(options: Partial<TestOptions>): TestContext;
|
|
9
9
|
declare function useTestContext(): TestContext;
|
package/dist/e2e.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { T as TestOptions, a as TestContext, b as TestHooks } from './shared/test-utils.
|
|
2
|
-
export { $ as $fetch, G as GotoOptions, S as StartServerOptions, h as TestRunner, c as createBrowser, d as createPage, f as fetch, g as getBrowser, s as startServer, e as stopServer, u as url, w as waitForHydration } from './shared/test-utils.
|
|
1
|
+
import { T as TestOptions, a as TestContext, b as TestHooks } from './shared/test-utils.C0h0-xb8.js';
|
|
2
|
+
export { $ as $fetch, G as GotoOptions, S as StartServerOptions, h as TestRunner, c as createBrowser, d as createPage, f as fetch, g as getBrowser, s as startServer, e as stopServer, u as url, w as waitForHydration } from './shared/test-utils.C0h0-xb8.js';
|
|
3
3
|
import { LogType } from 'consola';
|
|
4
4
|
import 'playwright-core';
|
|
5
5
|
import '@nuxt/schema';
|
|
6
|
-
import '
|
|
6
|
+
import 'tinyexec';
|
|
7
7
|
|
|
8
8
|
declare function createTestContext(options: Partial<TestOptions>): TestContext;
|
|
9
9
|
declare function useTestContext(): TestContext;
|
package/dist/e2e.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as distDir } from './shared/test-utils.
|
|
2
|
-
export { b as buildFixture, c as createBrowser, a as createPage, e as createTest, g as getBrowser, l as loadFixture, f as setup, s as setupMaps, w as waitForHydration } from './shared/test-utils.
|
|
3
|
-
import { u as useTestContext } from './shared/test-utils.
|
|
4
|
-
export { $ as $fetch, c as createTestContext, e as exposeContextToEnv, f as fetch, i as isDev, r as recoverContextFromEnv, s as setTestContext, a as startServer, b as stopServer, d as url } from './shared/test-utils.
|
|
1
|
+
import { d as distDir } from './shared/test-utils.CaqvQLs_.mjs';
|
|
2
|
+
export { b as buildFixture, c as createBrowser, a as createPage, e as createTest, g as getBrowser, l as loadFixture, f as setup, s as setupMaps, w as waitForHydration } from './shared/test-utils.CaqvQLs_.mjs';
|
|
3
|
+
import { u as useTestContext } from './shared/test-utils.ClQ9CUdo.mjs';
|
|
4
|
+
export { $ as $fetch, c as createTestContext, e as exposeContextToEnv, f as fetch, i as isDev, r as recoverContextFromEnv, s as setTestContext, a as startServer, b as stopServer, d as url } from './shared/test-utils.ClQ9CUdo.mjs';
|
|
5
5
|
import { consola } from 'consola';
|
|
6
6
|
import { resolve } from 'pathe';
|
|
7
7
|
import 'node:fs';
|
|
@@ -9,7 +9,7 @@ import 'node:path';
|
|
|
9
9
|
import 'defu';
|
|
10
10
|
import '@nuxt/kit';
|
|
11
11
|
import 'node:url';
|
|
12
|
-
import '
|
|
12
|
+
import 'tinyexec';
|
|
13
13
|
import 'get-port-please';
|
|
14
14
|
import 'ofetch';
|
|
15
15
|
import 'ufo';
|
package/dist/experimental.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'pathe';
|
|
2
2
|
import { stringifyQuery } from 'ufo';
|
|
3
|
-
import { $ as $fetch, u as useTestContext } from './shared/test-utils.
|
|
4
|
-
import '
|
|
3
|
+
import { $ as $fetch, u as useTestContext } from './shared/test-utils.ClQ9CUdo.mjs';
|
|
4
|
+
import 'tinyexec';
|
|
5
5
|
import 'get-port-please';
|
|
6
6
|
import 'ofetch';
|
|
7
7
|
import '@nuxt/kit';
|
package/dist/module.d.mts
CHANGED
|
@@ -6,6 +6,6 @@ interface NuxtVitestOptions {
|
|
|
6
6
|
logToConsole?: boolean;
|
|
7
7
|
vitestConfig?: UserConfig;
|
|
8
8
|
}
|
|
9
|
-
declare const _default: _nuxt_schema.NuxtModule<NuxtVitestOptions>;
|
|
9
|
+
declare const _default: _nuxt_schema.NuxtModule<NuxtVitestOptions, NuxtVitestOptions, false>;
|
|
10
10
|
|
|
11
11
|
export { type NuxtVitestOptions, _default as default };
|
package/dist/module.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ interface NuxtVitestOptions {
|
|
|
6
6
|
logToConsole?: boolean;
|
|
7
7
|
vitestConfig?: UserConfig;
|
|
8
8
|
}
|
|
9
|
-
declare const _default: _nuxt_schema.NuxtModule<NuxtVitestOptions>;
|
|
9
|
+
declare const _default: _nuxt_schema.NuxtModule<NuxtVitestOptions, NuxtVitestOptions, false>;
|
|
10
10
|
|
|
11
11
|
export { type NuxtVitestOptions, _default as default };
|
package/dist/module.mjs
CHANGED
|
@@ -49,7 +49,7 @@ const createMockPlugin = (ctx) => createUnplugin(() => {
|
|
|
49
49
|
if (isImportDeclaration(node)) {
|
|
50
50
|
if (node.source.value === "vitest" && !hasViImport) {
|
|
51
51
|
const viImport = node.specifiers.find(
|
|
52
|
-
(i) => isImportSpecifier(i) && i.imported.name === "vi"
|
|
52
|
+
(i) => isImportSpecifier(i) && i.imported.type === "Identifier" && i.imported.name === "vi"
|
|
53
53
|
);
|
|
54
54
|
if (viImport) {
|
|
55
55
|
insertionPoint = endOf(node);
|
package/dist/playwright.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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, b as TestHooks, G as GotoOptions } from './shared/test-utils.
|
|
4
|
+
import { T as TestOptions$1, b as TestHooks, G as GotoOptions } from './shared/test-utils.C0h0-xb8.mjs';
|
|
5
5
|
import '@nuxt/schema';
|
|
6
|
-
import '
|
|
6
|
+
import 'tinyexec';
|
|
7
7
|
|
|
8
8
|
type ConfigOptions = {
|
|
9
9
|
nuxt: Partial<TestOptions$1> | undefined;
|
package/dist/playwright.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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, b as TestHooks, G as GotoOptions } from './shared/test-utils.
|
|
4
|
+
import { T as TestOptions$1, b as TestHooks, G as GotoOptions } from './shared/test-utils.C0h0-xb8.js';
|
|
5
5
|
import '@nuxt/schema';
|
|
6
|
-
import '
|
|
6
|
+
import 'tinyexec';
|
|
7
7
|
|
|
8
8
|
type ConfigOptions = {
|
|
9
9
|
nuxt: Partial<TestOptions$1> | undefined;
|
package/dist/playwright.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { test as test$1 } from '@playwright/test';
|
|
2
2
|
export { expect } from '@playwright/test';
|
|
3
|
-
import { e as createTest, w as waitForHydration } from './shared/test-utils.
|
|
3
|
+
import { e as createTest, w as waitForHydration } from './shared/test-utils.CaqvQLs_.mjs';
|
|
4
4
|
import 'node:path';
|
|
5
5
|
import 'defu';
|
|
6
6
|
import 'ufo';
|
|
7
7
|
import 'consola';
|
|
8
8
|
import 'node:fs';
|
|
9
9
|
import '@nuxt/kit';
|
|
10
|
-
import { d as url } from './shared/test-utils.
|
|
10
|
+
import { d as url } from './shared/test-utils.ClQ9CUdo.mjs';
|
|
11
11
|
import 'pathe';
|
|
12
12
|
import 'node:url';
|
|
13
|
-
import '
|
|
13
|
+
import 'tinyexec';
|
|
14
14
|
import 'get-port-please';
|
|
15
15
|
import 'ofetch';
|
|
16
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
2
2
|
[key: string]: any;
|
|
3
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").
|
|
3
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
4
4
|
export default _default;
|
|
@@ -74,7 +74,7 @@ async function mountSuspended(component, options) {
|
|
|
74
74
|
..._options
|
|
75
75
|
} = options || {};
|
|
76
76
|
const vueApp = tryUseNuxtApp()?.vueApp || globalThis.__unctx__.get("nuxt-app").tryUse().vueApp;
|
|
77
|
-
const { render, setup } = component;
|
|
77
|
+
const { render, setup, data, computed, methods } = component;
|
|
78
78
|
let setupContext;
|
|
79
79
|
let setupState;
|
|
80
80
|
const setProps = reactive({});
|
|
@@ -120,6 +120,12 @@ async function mountSuspended(component, options) {
|
|
|
120
120
|
name: "MountSuspendedComponent",
|
|
121
121
|
...component,
|
|
122
122
|
render: render ? function(_ctx, ...args) {
|
|
123
|
+
if (data && typeof data === "function") {
|
|
124
|
+
const dataObject = data();
|
|
125
|
+
for (const key in dataObject) {
|
|
126
|
+
renderContext[key] = dataObject[key];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
123
129
|
for (const key in setupState || {}) {
|
|
124
130
|
renderContext[key] = isReadonly(setupState[key]) ? unref(setupState[key]) : setupState[key];
|
|
125
131
|
}
|
|
@@ -129,6 +135,16 @@ async function mountSuspended(component, options) {
|
|
|
129
135
|
for (const key in passedProps || {}) {
|
|
130
136
|
renderContext[key] = passedProps[key];
|
|
131
137
|
}
|
|
138
|
+
if (methods && typeof methods === "object") {
|
|
139
|
+
for (const key in methods) {
|
|
140
|
+
renderContext[key] = methods[key];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (computed && typeof computed === "object") {
|
|
144
|
+
for (const key in computed) {
|
|
145
|
+
renderContext[key] = computed[key].call(renderContext);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
132
148
|
return render.call(this, renderContext, ...args);
|
|
133
149
|
} : void 0,
|
|
134
150
|
setup: setup ? (props2) => wrappedSetup(props2, setupContext) : void 0
|
|
@@ -147,6 +163,7 @@ async function mountSuspended(component, options) {
|
|
|
147
163
|
config: {
|
|
148
164
|
globalProperties: vueApp.config.globalProperties
|
|
149
165
|
},
|
|
166
|
+
directives: vueApp._context.directives,
|
|
150
167
|
provide: vueApp._context.provides,
|
|
151
168
|
stubs: {
|
|
152
169
|
Suspense: false,
|
|
@@ -179,7 +196,7 @@ async function renderSuspended(component, options) {
|
|
|
179
196
|
} = options || {};
|
|
180
197
|
const { render: renderFromTestingLibrary } = await import('@testing-library/vue');
|
|
181
198
|
const vueApp = tryUseNuxtApp()?.vueApp || globalThis.__unctx__.get("nuxt-app").tryUse().vueApp;
|
|
182
|
-
const { render, setup } = component;
|
|
199
|
+
const { render, setup, data, computed, methods } = component;
|
|
183
200
|
let setupContext;
|
|
184
201
|
let setupState;
|
|
185
202
|
for (const fn of window.__cleanup || []) {
|
|
@@ -235,6 +252,12 @@ async function renderSuspended(component, options) {
|
|
|
235
252
|
name: "RenderSuspendedComponent",
|
|
236
253
|
...component,
|
|
237
254
|
render: render ? function(_ctx, ...args) {
|
|
255
|
+
if (data && typeof data === "function") {
|
|
256
|
+
const dataObject = data();
|
|
257
|
+
for (const key in dataObject) {
|
|
258
|
+
renderContext[key] = dataObject[key];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
238
261
|
for (const key in setupState || {}) {
|
|
239
262
|
renderContext[key] = isReadonly(setupState[key]) ? unref(setupState[key]) : setupState[key];
|
|
240
263
|
}
|
|
@@ -244,6 +267,16 @@ async function renderSuspended(component, options) {
|
|
|
244
267
|
for (const key in passedProps || {}) {
|
|
245
268
|
renderContext[key] = passedProps[key];
|
|
246
269
|
}
|
|
270
|
+
if (methods && typeof methods === "object") {
|
|
271
|
+
for (const key in methods) {
|
|
272
|
+
renderContext[key] = methods[key];
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (computed && typeof computed === "object") {
|
|
276
|
+
for (const key in computed) {
|
|
277
|
+
renderContext[key] = computed[key].call(renderContext);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
247
280
|
return render.call(this, renderContext, ...args);
|
|
248
281
|
} : void 0,
|
|
249
282
|
setup: setup ? (props2) => wrappedSetup(props2, setupContext) : void 0
|
|
@@ -262,6 +295,7 @@ async function renderSuspended(component, options) {
|
|
|
262
295
|
config: {
|
|
263
296
|
globalProperties: vueApp.config.globalProperties
|
|
264
297
|
},
|
|
298
|
+
directives: vueApp._context.directives,
|
|
265
299
|
provide: vueApp._context.provides,
|
|
266
300
|
components: { RouterLink }
|
|
267
301
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Browser, BrowserContextOptions, Page, Response as Response$1, LaunchOptions } from 'playwright-core';
|
|
2
2
|
import { NuxtConfig, Nuxt } from '@nuxt/schema';
|
|
3
|
-
import {
|
|
3
|
+
import { exec } from 'tinyexec';
|
|
4
4
|
|
|
5
5
|
declare function createBrowser(): Promise<void>;
|
|
6
6
|
declare function getBrowser(): Promise<Browser>;
|
|
@@ -90,7 +90,7 @@ interface TestContext {
|
|
|
90
90
|
nuxt?: Nuxt;
|
|
91
91
|
browser?: Browser;
|
|
92
92
|
url?: string;
|
|
93
|
-
serverProcess?:
|
|
93
|
+
serverProcess?: ReturnType<typeof exec>;
|
|
94
94
|
mockFn?: (...args: unknown[]) => unknown;
|
|
95
95
|
/**
|
|
96
96
|
* Functions to run on the vitest `afterAll` hook.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Browser, BrowserContextOptions, Page, Response as Response$1, LaunchOptions } from 'playwright-core';
|
|
2
2
|
import { NuxtConfig, Nuxt } from '@nuxt/schema';
|
|
3
|
-
import {
|
|
3
|
+
import { exec } from 'tinyexec';
|
|
4
4
|
|
|
5
5
|
declare function createBrowser(): Promise<void>;
|
|
6
6
|
declare function getBrowser(): Promise<Browser>;
|
|
@@ -90,7 +90,7 @@ interface TestContext {
|
|
|
90
90
|
nuxt?: Nuxt;
|
|
91
91
|
browser?: Browser;
|
|
92
92
|
url?: string;
|
|
93
|
-
serverProcess?:
|
|
93
|
+
serverProcess?: ReturnType<typeof exec>;
|
|
94
94
|
mockFn?: (...args: unknown[]) => unknown;
|
|
95
95
|
/**
|
|
96
96
|
* Functions to run on the vitest `afterAll` hook.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as useTestContext, d as url, c as createTestContext, s as setTestContext, b as stopServer, a as startServer } from './test-utils.
|
|
1
|
+
import { u as useTestContext, d as url, c as createTestContext, s as setTestContext, b as stopServer, a as startServer } from './test-utils.ClQ9CUdo.mjs';
|
|
2
2
|
import { existsSync, promises } from 'node:fs';
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import { defu } from 'defu';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { exec } from 'tinyexec';
|
|
2
2
|
import { getRandomPort, waitForPort } from 'get-port-please';
|
|
3
3
|
import { fetch as fetch$1, $fetch as $fetch$1 } from 'ofetch';
|
|
4
4
|
import * as _kit from '@nuxt/kit';
|
|
@@ -74,18 +74,20 @@ async function startServer(options = {}) {
|
|
|
74
74
|
ctx.url = `http://${host}:${port}/`;
|
|
75
75
|
if (ctx.options.dev) {
|
|
76
76
|
const nuxiCLI = await kit.resolvePath("nuxi/cli");
|
|
77
|
-
ctx.serverProcess =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
ctx.serverProcess = exec(nuxiCLI, ["_dev"], {
|
|
78
|
+
nodeOptions: {
|
|
79
|
+
cwd: ctx.nuxt.options.rootDir,
|
|
80
|
+
stdio: "inherit",
|
|
81
|
+
env: {
|
|
82
|
+
...process.env,
|
|
83
|
+
_PORT: String(port),
|
|
84
|
+
// Used by internal _dev command
|
|
85
|
+
PORT: String(port),
|
|
86
|
+
HOST: host,
|
|
87
|
+
NODE_ENV: "development",
|
|
88
|
+
...options.env,
|
|
89
|
+
...ctx.options.env
|
|
90
|
+
}
|
|
89
91
|
}
|
|
90
92
|
});
|
|
91
93
|
await waitForPort(port, { retries: 32, host }).catch(() => {
|
|
@@ -94,7 +96,9 @@ async function startServer(options = {}) {
|
|
|
94
96
|
for (let i = 0; i < 150; i++) {
|
|
95
97
|
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
|
96
98
|
try {
|
|
97
|
-
const res = await $fetch(ctx.nuxt.options.app.baseURL, {
|
|
99
|
+
const res = await $fetch(ctx.nuxt.options.app.baseURL, {
|
|
100
|
+
responseType: "text"
|
|
101
|
+
});
|
|
98
102
|
if (!res.includes("__NUXT_LOADING__")) {
|
|
99
103
|
return;
|
|
100
104
|
}
|
|
@@ -105,19 +109,23 @@ async function startServer(options = {}) {
|
|
|
105
109
|
ctx.serverProcess.kill();
|
|
106
110
|
throw lastError || new Error("Timeout waiting for dev server!");
|
|
107
111
|
} else {
|
|
108
|
-
ctx.serverProcess =
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
ctx.serverProcess = exec(
|
|
113
|
+
"node",
|
|
114
|
+
[resolve$1(ctx.nuxt.options.nitro.output.dir, "server/index.mjs")],
|
|
115
|
+
{
|
|
116
|
+
nodeOptions: {
|
|
117
|
+
stdio: "inherit",
|
|
118
|
+
env: {
|
|
119
|
+
...process.env,
|
|
120
|
+
PORT: String(port),
|
|
121
|
+
HOST: host,
|
|
122
|
+
NODE_ENV: "test",
|
|
123
|
+
...options.env,
|
|
124
|
+
...ctx.options.env
|
|
125
|
+
}
|
|
126
|
+
}
|
|
119
127
|
}
|
|
120
|
-
|
|
128
|
+
);
|
|
121
129
|
await waitForPort(port, { retries: 20, host });
|
|
122
130
|
}
|
|
123
131
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Environment
|
|
1
|
+
import { Environment } from 'vitest/environments';
|
|
2
2
|
import { App } from 'h3';
|
|
3
3
|
import { $Fetch } from 'nitropack';
|
|
4
|
+
import { JSDOMOptions, HappyDOMOptions } from 'vitest';
|
|
4
5
|
|
|
5
6
|
declare const _default: Environment;
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Environment
|
|
1
|
+
import { Environment } from 'vitest/environments';
|
|
2
2
|
import { App } from 'h3';
|
|
3
3
|
import { $Fetch } from 'nitropack';
|
|
4
|
+
import { JSDOMOptions, HappyDOMOptions } from 'vitest';
|
|
4
5
|
|
|
5
6
|
declare const _default: Environment;
|
|
6
7
|
|
|
@@ -54,7 +54,10 @@ const index = {
|
|
|
54
54
|
name: "nuxt",
|
|
55
55
|
transformMode: "web",
|
|
56
56
|
async setup(global, environmentOptions) {
|
|
57
|
-
const url = joinURL(
|
|
57
|
+
const url = joinURL(
|
|
58
|
+
environmentOptions?.nuxt.url ?? "http://localhost:3000",
|
|
59
|
+
environmentOptions?.nuxtRuntimeConfig.app?.baseURL || "/"
|
|
60
|
+
);
|
|
58
61
|
const environmentName = environmentOptions.nuxt.domEnvironment;
|
|
59
62
|
const environment = environmentMap[environmentName] || environmentMap["happy-dom"];
|
|
60
63
|
const { window: win, teardown } = await environment(global, defu(environmentOptions, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/test-utils",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/test-utils.git"
|
|
@@ -40,71 +40,71 @@
|
|
|
40
40
|
"release": "pnpm prepack && pnpm test:examples && changelogen --release --push"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@nuxt/kit": "^3.
|
|
44
|
-
"@nuxt/schema": "^3.
|
|
45
|
-
"c12": "^
|
|
43
|
+
"@nuxt/kit": "^3.13.2",
|
|
44
|
+
"@nuxt/schema": "^3.13.2",
|
|
45
|
+
"c12": "^2.0.1",
|
|
46
46
|
"consola": "^3.2.3",
|
|
47
47
|
"defu": "^6.1.4",
|
|
48
48
|
"destr": "^2.0.3",
|
|
49
49
|
"estree-walker": "^3.0.3",
|
|
50
|
-
"execa": "^8.0.1",
|
|
51
50
|
"fake-indexeddb": "^6.0.0",
|
|
52
51
|
"get-port-please": "^3.1.2",
|
|
53
52
|
"local-pkg": "^0.5.0",
|
|
54
53
|
"magic-string": "^0.30.11",
|
|
55
54
|
"node-fetch-native": "^1.6.4",
|
|
56
|
-
"ofetch": "^1.
|
|
55
|
+
"ofetch": "^1.4.0",
|
|
57
56
|
"pathe": "^1.1.2",
|
|
58
57
|
"perfect-debounce": "^1.0.0",
|
|
59
58
|
"radix3": "^1.1.2",
|
|
60
59
|
"scule": "^1.3.0",
|
|
61
60
|
"std-env": "^3.7.0",
|
|
61
|
+
"tinyexec": "^0.3.0",
|
|
62
62
|
"ufo": "^1.5.4",
|
|
63
63
|
"unenv": "^1.10.0",
|
|
64
|
-
"unplugin": "^1.
|
|
65
|
-
"vitest-environment-nuxt": "^1.0.
|
|
64
|
+
"unplugin": "^1.14.1",
|
|
65
|
+
"vitest-environment-nuxt": "^1.0.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@cucumber/cucumber": "
|
|
68
|
+
"@cucumber/cucumber": "11.0.1",
|
|
69
69
|
"@jest/globals": "29.7.0",
|
|
70
70
|
"@nuxt/devtools": "1.0.8",
|
|
71
|
-
"@nuxt/eslint-config": "0.5.
|
|
72
|
-
"@nuxt/module-builder": "0.8.
|
|
73
|
-
"@playwright/test": "1.
|
|
71
|
+
"@nuxt/eslint-config": "0.5.7",
|
|
72
|
+
"@nuxt/module-builder": "0.8.4",
|
|
73
|
+
"@playwright/test": "1.47.2",
|
|
74
74
|
"@testing-library/vue": "8.1.0",
|
|
75
|
-
"@types/estree": "1.0.
|
|
75
|
+
"@types/estree": "1.0.6",
|
|
76
76
|
"@types/jsdom": "21.1.7",
|
|
77
77
|
"@types/semver": "7.5.8",
|
|
78
|
-
"@vitest/ui": "2.
|
|
78
|
+
"@vitest/ui": "2.1.2",
|
|
79
79
|
"@vue/test-utils": "2.4.6",
|
|
80
|
-
"changelogen": "0.5.
|
|
80
|
+
"changelogen": "0.5.7",
|
|
81
81
|
"compatx": "0.1.8",
|
|
82
|
-
"eslint": "9.
|
|
83
|
-
"h3": "1.
|
|
84
|
-
"jiti": "
|
|
82
|
+
"eslint": "9.12.0",
|
|
83
|
+
"h3": "1.13.0",
|
|
84
|
+
"jiti": "2.3.1",
|
|
85
85
|
"nitropack": "2.9.7",
|
|
86
|
-
"nuxt": "3.
|
|
87
|
-
"playwright-core": "1.
|
|
88
|
-
"rollup": "4.
|
|
86
|
+
"nuxt": "3.13.2",
|
|
87
|
+
"playwright-core": "1.47.2",
|
|
88
|
+
"rollup": "4.24.0",
|
|
89
89
|
"semver": "7.6.3",
|
|
90
|
-
"typescript": "5.
|
|
90
|
+
"typescript": "5.6.2",
|
|
91
91
|
"unbuild": "latest",
|
|
92
|
-
"unimport": "3.
|
|
93
|
-
"vite": "5.4.
|
|
94
|
-
"vitest": "2.
|
|
95
|
-
"vue-router": "4.4.
|
|
96
|
-
"vue-tsc": "2.
|
|
92
|
+
"unimport": "3.13.1",
|
|
93
|
+
"vite": "5.4.8",
|
|
94
|
+
"vitest": "2.1.2",
|
|
95
|
+
"vue-router": "4.4.5",
|
|
96
|
+
"vue-tsc": "2.1.6"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@cucumber/cucumber": "^10.3.1",
|
|
99
|
+
"@cucumber/cucumber": "^10.3.1 || ^11.0.0",
|
|
100
100
|
"@jest/globals": "^29.5.0",
|
|
101
101
|
"@playwright/test": "^1.43.1",
|
|
102
102
|
"@testing-library/vue": "^7.0.0 || ^8.0.1",
|
|
103
103
|
"@vitest/ui": "^0.34.6 || ^1.0.0 || ^2.0.0",
|
|
104
104
|
"@vue/test-utils": "^2.4.2",
|
|
105
105
|
"h3": "*",
|
|
106
|
-
"happy-dom": "^9.10.9 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
107
|
-
"jsdom": "^22.0.0 || ^23.0.0 || ^24.0.0",
|
|
106
|
+
"happy-dom": "^9.10.9 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
107
|
+
"jsdom": "^22.0.0 || ^23.0.0 || ^24.0.0 || ^25.0.0",
|
|
108
108
|
"nitropack": "*",
|
|
109
109
|
"playwright-core": "^1.43.1",
|
|
110
110
|
"vite": "*",
|
|
@@ -145,19 +145,19 @@
|
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
147
|
"resolutions": {
|
|
148
|
-
"@cucumber/cucumber": "
|
|
148
|
+
"@cucumber/cucumber": "11.0.1",
|
|
149
149
|
"@nuxt/devtools": "1.0.8",
|
|
150
|
-
"@nuxt/kit": "^3.
|
|
151
|
-
"@nuxt/schema": "^3.
|
|
150
|
+
"@nuxt/kit": "^3.13.2",
|
|
151
|
+
"@nuxt/schema": "^3.13.2",
|
|
152
152
|
"@nuxt/test-utils": "workspace:*",
|
|
153
|
-
"rollup": "4.
|
|
154
|
-
"vite": "5.4.
|
|
155
|
-
"vite-node": "2.
|
|
156
|
-
"vitest": "2.
|
|
157
|
-
"vue": "^3.
|
|
153
|
+
"rollup": "4.24.0",
|
|
154
|
+
"vite": "5.4.8",
|
|
155
|
+
"vite-node": "2.1.2",
|
|
156
|
+
"vitest": "2.1.2",
|
|
157
|
+
"vue": "^3.5.11"
|
|
158
158
|
},
|
|
159
159
|
"engines": {
|
|
160
160
|
"node": ">=18.20.4"
|
|
161
161
|
},
|
|
162
|
-
"packageManager": "pnpm@9.
|
|
162
|
+
"packageManager": "pnpm@9.12.0"
|
|
163
163
|
}
|