@nuxt/test-utils 3.14.3 → 3.15.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.
- package/dirs.js +3 -0
- package/dist/e2e.d.mts +2 -2
- package/dist/e2e.d.ts +2 -2
- package/dist/e2e.mjs +4 -5
- package/dist/experimental.mjs +1 -1
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/playwright.d.mts +6 -1
- package/dist/playwright.d.ts +6 -1
- package/dist/playwright.mjs +7 -6
- package/dist/runtime-utils/index.mjs +52 -10
- package/dist/shared/{test-utils.CaqvQLs_.mjs → test-utils.2f8PJqdD.mjs} +4 -8
- package/dist/shared/{test-utils.ClQ9CUdo.mjs → test-utils.CzsWF8o2.mjs} +7 -1
- package/dist/shared/{test-utils.C0h0-xb8.d.mts → test-utils.DsSnl8Os.d.mts} +2 -2
- package/dist/shared/{test-utils.C0h0-xb8.d.ts → test-utils.DsSnl8Os.d.ts} +2 -2
- package/dist/vitest-environment.d.mts +1 -1
- package/dist/vitest-environment.d.ts +1 -1
- package/dist/vitest-environment.mjs +9 -1
- package/package.json +50 -52
package/dirs.js
ADDED
package/dist/e2e.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.DsSnl8Os.mjs';
|
|
2
|
+
export { $ as $fetch, G as GotoOptions, N as NuxtPage, 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.DsSnl8Os.mjs';
|
|
3
3
|
import { LogType } from 'consola';
|
|
4
4
|
import 'playwright-core';
|
|
5
5
|
import '@nuxt/schema';
|
package/dist/e2e.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.DsSnl8Os.js';
|
|
2
|
+
export { $ as $fetch, G as GotoOptions, N as NuxtPage, 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.DsSnl8Os.js';
|
|
3
3
|
import { LogType } from 'consola';
|
|
4
4
|
import 'playwright-core';
|
|
5
5
|
import '@nuxt/schema';
|
package/dist/e2e.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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';
|
|
1
|
+
export { b as buildFixture, c as createBrowser, a as createPage, d as createTest, g as getBrowser, l as loadFixture, e as setup, s as setupMaps, w as waitForHydration } from './shared/test-utils.2f8PJqdD.mjs';
|
|
2
|
+
import { u as useTestContext } from './shared/test-utils.CzsWF8o2.mjs';
|
|
3
|
+
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.CzsWF8o2.mjs';
|
|
5
4
|
import { consola } from 'consola';
|
|
6
5
|
import { resolve } from 'pathe';
|
|
6
|
+
import { distDir } from '#dirs';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import 'node:path';
|
|
9
9
|
import 'defu';
|
|
10
10
|
import '@nuxt/kit';
|
|
11
|
-
import 'node:url';
|
|
12
11
|
import 'tinyexec';
|
|
13
12
|
import 'get-port-please';
|
|
14
13
|
import 'ofetch';
|
package/dist/experimental.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'pathe';
|
|
2
2
|
import { stringifyQuery } from 'ufo';
|
|
3
|
-
import { $ as $fetch, u as useTestContext } from './shared/test-utils.
|
|
3
|
+
import { $ as $fetch, u as useTestContext } from './shared/test-utils.CzsWF8o2.mjs';
|
|
4
4
|
import 'tinyexec';
|
|
5
5
|
import 'get-port-please';
|
|
6
6
|
import 'ofetch';
|
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/playwright.d.mts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
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.DsSnl8Os.mjs';
|
|
5
5
|
import '@nuxt/schema';
|
|
6
6
|
import 'tinyexec';
|
|
7
7
|
|
|
8
8
|
type ConfigOptions = {
|
|
9
9
|
nuxt: Partial<TestOptions$1> | undefined;
|
|
10
|
+
defaults: {
|
|
11
|
+
nuxt: Partial<TestOptions$1> | undefined;
|
|
12
|
+
};
|
|
10
13
|
};
|
|
11
14
|
type WorkerOptions = {
|
|
12
15
|
_nuxtHooks: TestHooks;
|
|
@@ -27,6 +30,8 @@ type TestOptions = {
|
|
|
27
30
|
}
|
|
28
31
|
})
|
|
29
32
|
```
|
|
33
|
+
*
|
|
34
|
+
* In `playwright.config.ts` you can pass `defaults: { nuxt: {} }` object for merging with test.use nuxt options
|
|
30
35
|
*/
|
|
31
36
|
declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & TestOptions, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & WorkerOptions & ConfigOptions>;
|
|
32
37
|
|
package/dist/playwright.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
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.DsSnl8Os.js';
|
|
5
5
|
import '@nuxt/schema';
|
|
6
6
|
import 'tinyexec';
|
|
7
7
|
|
|
8
8
|
type ConfigOptions = {
|
|
9
9
|
nuxt: Partial<TestOptions$1> | undefined;
|
|
10
|
+
defaults: {
|
|
11
|
+
nuxt: Partial<TestOptions$1> | undefined;
|
|
12
|
+
};
|
|
10
13
|
};
|
|
11
14
|
type WorkerOptions = {
|
|
12
15
|
_nuxtHooks: TestHooks;
|
|
@@ -27,6 +30,8 @@ type TestOptions = {
|
|
|
27
30
|
}
|
|
28
31
|
})
|
|
29
32
|
```
|
|
33
|
+
*
|
|
34
|
+
* In `playwright.config.ts` you can pass `defaults: { nuxt: {} }` object for merging with test.use nuxt options
|
|
30
35
|
*/
|
|
31
36
|
declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & TestOptions, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & WorkerOptions & ConfigOptions>;
|
|
32
37
|
|
package/dist/playwright.mjs
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
+
import defu from 'defu';
|
|
1
2
|
import { test as test$1 } from '@playwright/test';
|
|
2
3
|
export { expect } from '@playwright/test';
|
|
3
|
-
import {
|
|
4
|
+
import { d as createTest, w as waitForHydration } from './shared/test-utils.2f8PJqdD.mjs';
|
|
4
5
|
import 'node:path';
|
|
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.CzsWF8o2.mjs';
|
|
11
11
|
import 'pathe';
|
|
12
|
-
import '
|
|
12
|
+
import '#dirs';
|
|
13
13
|
import 'tinyexec';
|
|
14
14
|
import 'get-port-please';
|
|
15
15
|
import 'ofetch';
|
|
16
16
|
|
|
17
17
|
const test = test$1.extend({
|
|
18
18
|
nuxt: [void 0, { option: true, scope: "worker" }],
|
|
19
|
+
defaults: [{ nuxt: void 0 }, { option: true, scope: "worker" }],
|
|
19
20
|
_nuxtHooks: [
|
|
20
|
-
async ({ nuxt }, use) => {
|
|
21
|
-
const hooks = createTest(nuxt || {});
|
|
21
|
+
async ({ nuxt, defaults }, use) => {
|
|
22
|
+
const hooks = createTest(defu(nuxt || {}, defaults.nuxt || {}));
|
|
22
23
|
await hooks.setup();
|
|
23
24
|
await use(hooks);
|
|
24
25
|
await hooks.afterAll();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineEventHandler } from 'h3';
|
|
2
2
|
import { mount } from '@vue/test-utils';
|
|
3
|
-
import { reactive, h as h$1, Suspense, nextTick, isReadonly, unref, effectScope } from 'vue';
|
|
3
|
+
import { reactive as reactive$1, h as h$1, Suspense, nextTick, getCurrentInstance, isReadonly, unref, effectScope } from 'vue';
|
|
4
4
|
import { createDefu, defu } from 'defu';
|
|
5
5
|
import { defineComponent, useRouter, h, tryUseNuxtApp } from '#imports';
|
|
6
6
|
import NuxtRoot from '#build/root-component.mjs';
|
|
@@ -77,7 +77,7 @@ async function mountSuspended(component, options) {
|
|
|
77
77
|
const { render, setup, data, computed, methods } = component;
|
|
78
78
|
let setupContext;
|
|
79
79
|
let setupState;
|
|
80
|
-
const setProps = reactive({});
|
|
80
|
+
const setProps = reactive$1({});
|
|
81
81
|
let passedProps;
|
|
82
82
|
const wrappedSetup = async (props2, setupContext2) => {
|
|
83
83
|
passedProps = props2;
|
|
@@ -120,6 +120,10 @@ async function mountSuspended(component, options) {
|
|
|
120
120
|
name: "MountSuspendedComponent",
|
|
121
121
|
...component,
|
|
122
122
|
render: render ? function(_ctx, ...args) {
|
|
123
|
+
const currentInstance = getCurrentInstance();
|
|
124
|
+
if (currentInstance) {
|
|
125
|
+
currentInstance.emit = setupContext.emit;
|
|
126
|
+
}
|
|
123
127
|
if (data && typeof data === "function") {
|
|
124
128
|
const dataObject = data();
|
|
125
129
|
for (const key in dataObject) {
|
|
@@ -127,17 +131,29 @@ async function mountSuspended(component, options) {
|
|
|
127
131
|
}
|
|
128
132
|
}
|
|
129
133
|
for (const key in setupState || {}) {
|
|
130
|
-
|
|
134
|
+
const warn = console.warn;
|
|
135
|
+
console.warn = () => {
|
|
136
|
+
};
|
|
137
|
+
try {
|
|
138
|
+
renderContext[key] = isReadonly(setupState[key]) ? unref(setupState[key]) : setupState[key];
|
|
139
|
+
} catch {
|
|
140
|
+
} finally {
|
|
141
|
+
console.warn = warn;
|
|
142
|
+
}
|
|
143
|
+
if (key === "props") {
|
|
144
|
+
renderContext[key] = cloneProps$1(renderContext[key]);
|
|
145
|
+
}
|
|
131
146
|
}
|
|
147
|
+
const propsContext = "props" in renderContext ? renderContext.props : renderContext;
|
|
132
148
|
for (const key in props || {}) {
|
|
133
|
-
|
|
149
|
+
propsContext[key] = _ctx[key];
|
|
134
150
|
}
|
|
135
151
|
for (const key in passedProps || {}) {
|
|
136
|
-
|
|
152
|
+
propsContext[key] = passedProps[key];
|
|
137
153
|
}
|
|
138
154
|
if (methods && typeof methods === "object") {
|
|
139
155
|
for (const key in methods) {
|
|
140
|
-
renderContext[key] = methods[key];
|
|
156
|
+
renderContext[key] = methods[key].bind(renderContext);
|
|
141
157
|
}
|
|
142
158
|
}
|
|
143
159
|
if (computed && typeof computed === "object") {
|
|
@@ -184,6 +200,13 @@ const defuReplaceArray = createDefu((obj, key, value) => {
|
|
|
184
200
|
return true;
|
|
185
201
|
}
|
|
186
202
|
});
|
|
203
|
+
function cloneProps$1(props) {
|
|
204
|
+
const newProps = reactive$1({});
|
|
205
|
+
for (const key in props) {
|
|
206
|
+
newProps[key] = props[key];
|
|
207
|
+
}
|
|
208
|
+
return newProps;
|
|
209
|
+
}
|
|
187
210
|
|
|
188
211
|
const WRAPPER_EL_ID = "test-wrapper";
|
|
189
212
|
async function renderSuspended(component, options) {
|
|
@@ -259,17 +282,29 @@ async function renderSuspended(component, options) {
|
|
|
259
282
|
}
|
|
260
283
|
}
|
|
261
284
|
for (const key in setupState || {}) {
|
|
262
|
-
|
|
285
|
+
const warn = console.warn;
|
|
286
|
+
console.warn = () => {
|
|
287
|
+
};
|
|
288
|
+
try {
|
|
289
|
+
renderContext[key] = isReadonly(setupState[key]) ? unref(setupState[key]) : setupState[key];
|
|
290
|
+
} catch {
|
|
291
|
+
} finally {
|
|
292
|
+
console.warn = warn;
|
|
293
|
+
}
|
|
294
|
+
if (key === "props") {
|
|
295
|
+
renderContext[key] = cloneProps(renderContext[key]);
|
|
296
|
+
}
|
|
263
297
|
}
|
|
298
|
+
const propsContext = "props" in renderContext ? renderContext.props : renderContext;
|
|
264
299
|
for (const key in props || {}) {
|
|
265
|
-
|
|
300
|
+
propsContext[key] = _ctx[key];
|
|
266
301
|
}
|
|
267
302
|
for (const key in passedProps || {}) {
|
|
268
|
-
|
|
303
|
+
propsContext[key] = passedProps[key];
|
|
269
304
|
}
|
|
270
305
|
if (methods && typeof methods === "object") {
|
|
271
306
|
for (const key in methods) {
|
|
272
|
-
renderContext[key] = methods[key];
|
|
307
|
+
renderContext[key] = methods[key].bind(renderContext);
|
|
273
308
|
}
|
|
274
309
|
}
|
|
275
310
|
if (computed && typeof computed === "object") {
|
|
@@ -303,5 +338,12 @@ async function renderSuspended(component, options) {
|
|
|
303
338
|
);
|
|
304
339
|
});
|
|
305
340
|
}
|
|
341
|
+
function cloneProps(props) {
|
|
342
|
+
const newProps = reactive({});
|
|
343
|
+
for (const key in props) {
|
|
344
|
+
newProps[key] = props[key];
|
|
345
|
+
}
|
|
346
|
+
return newProps;
|
|
347
|
+
}
|
|
306
348
|
|
|
307
349
|
export { mockComponent, mockNuxtImport, mountSuspended, registerEndpoint, renderSuspended };
|
|
@@ -1,10 +1,8 @@
|
|
|
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.CzsWF8o2.mjs';
|
|
2
2
|
import { existsSync, promises } from 'node:fs';
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import * as _kit from '@nuxt/kit';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { dirname } from 'pathe';
|
|
8
6
|
|
|
9
7
|
async function createBrowser() {
|
|
10
8
|
const ctx = useTestContext();
|
|
@@ -47,7 +45,7 @@ async function createPage(path, options) {
|
|
|
47
45
|
return res;
|
|
48
46
|
};
|
|
49
47
|
if (path) {
|
|
50
|
-
await page.goto(url(path), { waitUntil: "hydration" });
|
|
48
|
+
await page.goto(url(path), options?.javaScriptEnabled === false ? {} : { waitUntil: "hydration" });
|
|
51
49
|
}
|
|
52
50
|
return page;
|
|
53
51
|
}
|
|
@@ -129,7 +127,7 @@ async function setupJest(hooks) {
|
|
|
129
127
|
test("setup", hooks.setup, hooks.ctx.options.setupTimeout);
|
|
130
128
|
beforeEach(hooks.beforeEach);
|
|
131
129
|
afterEach(hooks.afterEach);
|
|
132
|
-
afterAll(hooks.afterAll);
|
|
130
|
+
afterAll(hooks.afterAll, 2e4);
|
|
133
131
|
}
|
|
134
132
|
|
|
135
133
|
async function setupVitest(hooks) {
|
|
@@ -199,6 +197,4 @@ async function setup(options = {}) {
|
|
|
199
197
|
await setupFn(hooks);
|
|
200
198
|
}
|
|
201
199
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
export { createPage as a, buildFixture as b, createBrowser as c, distDir as d, createTest as e, setup as f, getBrowser as g, loadFixture as l, setupMaps as s, waitForHydration as w };
|
|
200
|
+
export { createPage as a, buildFixture as b, createBrowser as c, createTest as d, setup as e, getBrowser as g, loadFixture as l, setupMaps as s, waitForHydration as w };
|
|
@@ -9,6 +9,7 @@ import { defu } from 'defu';
|
|
|
9
9
|
|
|
10
10
|
let currentContext;
|
|
11
11
|
function createTestContext(options) {
|
|
12
|
+
var _a;
|
|
12
13
|
const _options = defu(options, {
|
|
13
14
|
testDir: resolve(process.cwd(), "test"),
|
|
14
15
|
fixture: "fixture",
|
|
@@ -18,6 +19,7 @@ function createTestContext(options) {
|
|
|
18
19
|
logLevel: 1,
|
|
19
20
|
server: true,
|
|
20
21
|
build: options.browser !== false || options.server !== false,
|
|
22
|
+
env: {},
|
|
21
23
|
nuxtConfig: {
|
|
22
24
|
// suppress compatibility date warning for runtime environment tests
|
|
23
25
|
compatibilityDate: "2024-04-03"
|
|
@@ -26,6 +28,9 @@ function createTestContext(options) {
|
|
|
26
28
|
type: "chromium"
|
|
27
29
|
}
|
|
28
30
|
});
|
|
31
|
+
if (!_options.dev) {
|
|
32
|
+
(_a = _options.env).NODE_ENV || (_a.NODE_ENV = "production");
|
|
33
|
+
}
|
|
29
34
|
if (_options.host) {
|
|
30
35
|
_options.build = false;
|
|
31
36
|
_options.server = false;
|
|
@@ -109,9 +114,10 @@ async function startServer(options = {}) {
|
|
|
109
114
|
ctx.serverProcess.kill();
|
|
110
115
|
throw lastError || new Error("Timeout waiting for dev server!");
|
|
111
116
|
} else {
|
|
117
|
+
const outputDir = ctx.nuxt ? ctx.nuxt.options.nitro.output.dir : ctx.options.nuxtConfig.nitro.output.dir;
|
|
112
118
|
ctx.serverProcess = exec(
|
|
113
119
|
"node",
|
|
114
|
-
[resolve$1(
|
|
120
|
+
[resolve$1(outputDir, "server/index.mjs")],
|
|
115
121
|
{
|
|
116
122
|
nodeOptions: {
|
|
117
123
|
stdio: "inherit",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Browser,
|
|
1
|
+
import { Browser, Page, Response as Response$1, BrowserContextOptions, LaunchOptions } from 'playwright-core';
|
|
2
2
|
import { NuxtConfig, Nuxt } from '@nuxt/schema';
|
|
3
3
|
import { exec } from 'tinyexec';
|
|
4
4
|
|
|
@@ -106,4 +106,4 @@ interface TestHooks {
|
|
|
106
106
|
ctx: TestContext;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
export { $fetch as $, type GotoOptions as G, type StartServerOptions as S, type TestOptions as T, type TestContext as a, type TestHooks as b, createBrowser as c, createPage as d, stopServer as e, fetch as f, getBrowser as g, type TestRunner as h, startServer as s, url as u, waitForHydration as w };
|
|
109
|
+
export { $fetch as $, type GotoOptions as G, type NuxtPage as N, type StartServerOptions as S, type TestOptions as T, type TestContext as a, type TestHooks as b, createBrowser as c, createPage as d, stopServer as e, fetch as f, getBrowser as g, type TestRunner as h, startServer as s, url as u, waitForHydration as w };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Browser,
|
|
1
|
+
import { Browser, Page, Response as Response$1, BrowserContextOptions, LaunchOptions } from 'playwright-core';
|
|
2
2
|
import { NuxtConfig, Nuxt } from '@nuxt/schema';
|
|
3
3
|
import { exec } from 'tinyexec';
|
|
4
4
|
|
|
@@ -106,4 +106,4 @@ interface TestHooks {
|
|
|
106
106
|
ctx: TestContext;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
export { $fetch as $, type GotoOptions as G, type StartServerOptions as S, type TestOptions as T, type TestContext as a, type TestHooks as b, createBrowser as c, createPage as d, stopServer as e, fetch as f, getBrowser as g, type TestRunner as h, startServer as s, url as u, waitForHydration as w };
|
|
109
|
+
export { $fetch as $, type GotoOptions as G, type NuxtPage as N, type StartServerOptions as S, type TestOptions as T, type TestContext as a, type TestHooks as b, createBrowser as c, createPage as d, stopServer as e, fetch as f, getBrowser as g, type TestRunner as h, startServer as s, url as u, waitForHydration as w };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
+
import { JSDOMOptions, HappyDOMOptions } from 'vitest/node';
|
|
5
5
|
|
|
6
6
|
declare const _default: Environment;
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
+
import { JSDOMOptions, HappyDOMOptions } from 'vitest/node';
|
|
5
5
|
|
|
6
6
|
declare const _default: Environment;
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ const happyDom = (async function(_, { happyDom = {} }) {
|
|
|
14
14
|
return {
|
|
15
15
|
window,
|
|
16
16
|
teardown() {
|
|
17
|
-
window.happyDOM.
|
|
17
|
+
window.happyDOM.abort();
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
});
|
|
@@ -58,6 +58,13 @@ const index = {
|
|
|
58
58
|
environmentOptions?.nuxt.url ?? "http://localhost:3000",
|
|
59
59
|
environmentOptions?.nuxtRuntimeConfig.app?.baseURL || "/"
|
|
60
60
|
);
|
|
61
|
+
const consoleInfo = console.info;
|
|
62
|
+
console.info = (...args) => {
|
|
63
|
+
if (args[0] === "<Suspense> is an experimental feature and its API will likely change.") {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
return consoleInfo(...args);
|
|
67
|
+
};
|
|
61
68
|
const environmentName = environmentOptions.nuxt.domEnvironment;
|
|
62
69
|
const environment = environmentMap[environmentName] || environmentMap["happy-dom"];
|
|
63
70
|
const { window: win, teardown } = await environment(global, defu(environmentOptions, {
|
|
@@ -160,6 +167,7 @@ const index = {
|
|
|
160
167
|
// called after all tests with this env have been run
|
|
161
168
|
teardown() {
|
|
162
169
|
keys.forEach((key) => delete global[key]);
|
|
170
|
+
console.info = consoleInfo;
|
|
163
171
|
originals.forEach((v, k) => global[k] = v);
|
|
164
172
|
teardown();
|
|
165
173
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/test-utils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/test-utils.git"
|
|
@@ -19,8 +19,12 @@
|
|
|
19
19
|
"./runtime": "./dist/runtime-utils/index.mjs",
|
|
20
20
|
"./vitest-environment": "./dist/vitest-environment.mjs"
|
|
21
21
|
},
|
|
22
|
+
"imports": {
|
|
23
|
+
"#dirs": "./dirs.js"
|
|
24
|
+
},
|
|
22
25
|
"files": [
|
|
23
26
|
"dist",
|
|
27
|
+
"dirs.js",
|
|
24
28
|
"config.d.ts",
|
|
25
29
|
"e2e.d.ts",
|
|
26
30
|
"experimental.d.ts",
|
|
@@ -40,8 +44,8 @@
|
|
|
40
44
|
"release": "pnpm prepack && pnpm test:examples && changelogen --release --push"
|
|
41
45
|
},
|
|
42
46
|
"dependencies": {
|
|
43
|
-
"@nuxt/kit": "^3.
|
|
44
|
-
"@nuxt/schema": "^3.
|
|
47
|
+
"@nuxt/kit": "^3.14.1592",
|
|
48
|
+
"@nuxt/schema": "^3.14.1592",
|
|
45
49
|
"c12": "^2.0.1",
|
|
46
50
|
"consola": "^3.2.3",
|
|
47
51
|
"defu": "^6.1.4",
|
|
@@ -49,115 +53,109 @@
|
|
|
49
53
|
"estree-walker": "^3.0.3",
|
|
50
54
|
"fake-indexeddb": "^6.0.0",
|
|
51
55
|
"get-port-please": "^3.1.2",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
56
|
+
"h3": "^1.13.0",
|
|
57
|
+
"local-pkg": "^0.5.1",
|
|
58
|
+
"magic-string": "^0.30.14",
|
|
54
59
|
"node-fetch-native": "^1.6.4",
|
|
55
|
-
"ofetch": "^1.4.
|
|
60
|
+
"ofetch": "^1.4.1",
|
|
56
61
|
"pathe": "^1.1.2",
|
|
57
62
|
"perfect-debounce": "^1.0.0",
|
|
58
63
|
"radix3": "^1.1.2",
|
|
59
64
|
"scule": "^1.3.0",
|
|
60
|
-
"std-env": "^3.
|
|
61
|
-
"tinyexec": "^0.3.
|
|
65
|
+
"std-env": "^3.8.0",
|
|
66
|
+
"tinyexec": "^0.3.1",
|
|
62
67
|
"ufo": "^1.5.4",
|
|
63
68
|
"unenv": "^1.10.0",
|
|
64
|
-
"unplugin": "^
|
|
65
|
-
"
|
|
69
|
+
"unplugin": "^2.0.0",
|
|
70
|
+
"vite": "^5.4.11",
|
|
71
|
+
"vitest-environment-nuxt": "^1.0.1",
|
|
72
|
+
"vue": "^3.5.13"
|
|
66
73
|
},
|
|
67
74
|
"devDependencies": {
|
|
68
|
-
"@cucumber/cucumber": "11.0
|
|
75
|
+
"@cucumber/cucumber": "11.1.0",
|
|
69
76
|
"@jest/globals": "29.7.0",
|
|
70
|
-
"@nuxt/
|
|
71
|
-
"@
|
|
72
|
-
"@nuxt/module-builder": "0.8.4",
|
|
73
|
-
"@playwright/test": "1.47.2",
|
|
77
|
+
"@nuxt/eslint-config": "0.7.2",
|
|
78
|
+
"@playwright/test": "1.49.0",
|
|
74
79
|
"@testing-library/vue": "8.1.0",
|
|
75
80
|
"@types/estree": "1.0.6",
|
|
76
81
|
"@types/jsdom": "21.1.7",
|
|
77
82
|
"@types/semver": "7.5.8",
|
|
78
|
-
"@vitest/ui": "2.1.2",
|
|
79
83
|
"@vue/test-utils": "2.4.6",
|
|
80
84
|
"changelogen": "0.5.7",
|
|
81
85
|
"compatx": "0.1.8",
|
|
82
|
-
"eslint": "9.
|
|
83
|
-
"
|
|
84
|
-
"jiti": "2.
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
86
|
+
"eslint": "9.16.0",
|
|
87
|
+
"installed-check": "9.3.0",
|
|
88
|
+
"jiti": "2.4.1",
|
|
89
|
+
"knip": "5.39.2",
|
|
90
|
+
"nitropack": "2.10.4",
|
|
91
|
+
"nuxt": "3.14.1592",
|
|
92
|
+
"playwright-core": "1.49.0",
|
|
93
|
+
"rollup": "4.28.0",
|
|
89
94
|
"semver": "7.6.3",
|
|
90
|
-
"typescript": "5.6.
|
|
95
|
+
"typescript": "5.6.3",
|
|
91
96
|
"unbuild": "latest",
|
|
92
|
-
"unimport": "3.
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"vue-
|
|
96
|
-
"vue-tsc": "2.1.6"
|
|
97
|
+
"unimport": "3.14.3",
|
|
98
|
+
"vitest": "2.1.8",
|
|
99
|
+
"vue-router": "4.5.0",
|
|
100
|
+
"vue-tsc": "2.1.10"
|
|
97
101
|
},
|
|
98
102
|
"peerDependencies": {
|
|
99
103
|
"@cucumber/cucumber": "^10.3.1 || ^11.0.0",
|
|
100
104
|
"@jest/globals": "^29.5.0",
|
|
101
105
|
"@playwright/test": "^1.43.1",
|
|
102
106
|
"@testing-library/vue": "^7.0.0 || ^8.0.1",
|
|
103
|
-
"@vitest/ui": "^0.34.6 || ^1.0.0 || ^2.0.0",
|
|
104
107
|
"@vue/test-utils": "^2.4.2",
|
|
105
|
-
"h3": "*",
|
|
106
108
|
"happy-dom": "^9.10.9 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
107
109
|
"jsdom": "^22.0.0 || ^23.0.0 || ^24.0.0 || ^25.0.0",
|
|
108
|
-
"nitropack": "*",
|
|
109
110
|
"playwright-core": "^1.43.1",
|
|
110
|
-
"
|
|
111
|
-
"vitest": "^0.34.6 || ^1.0.0 || ^2.0.0",
|
|
112
|
-
"vue": "^3.3.4",
|
|
113
|
-
"vue-router": "^4.0.0"
|
|
111
|
+
"vitest": "^0.34.6 || ^1.0.0 || ^2.0.0"
|
|
114
112
|
},
|
|
115
113
|
"peerDependenciesMeta": {
|
|
116
114
|
"@cucumber/cucumber": {
|
|
117
115
|
"optional": true
|
|
118
116
|
},
|
|
117
|
+
"@jest/globals": {
|
|
118
|
+
"optional": true
|
|
119
|
+
},
|
|
119
120
|
"@playwright/test": {
|
|
120
121
|
"optional": true
|
|
121
122
|
},
|
|
122
123
|
"@testing-library/vue": {
|
|
123
124
|
"optional": true
|
|
124
125
|
},
|
|
125
|
-
"
|
|
126
|
+
"@vitest/ui": {
|
|
126
127
|
"optional": true
|
|
127
128
|
},
|
|
128
129
|
"@vue/test-utils": {
|
|
129
130
|
"optional": true
|
|
130
131
|
},
|
|
131
|
-
"
|
|
132
|
+
"happy-dom": {
|
|
132
133
|
"optional": true
|
|
133
134
|
},
|
|
134
|
-
"
|
|
135
|
+
"jsdom": {
|
|
135
136
|
"optional": true
|
|
136
137
|
},
|
|
137
138
|
"playwright-core": {
|
|
138
139
|
"optional": true
|
|
139
140
|
},
|
|
140
|
-
"@vitest/ui": {
|
|
141
|
-
"optional": true
|
|
142
|
-
},
|
|
143
141
|
"vitest": {
|
|
144
142
|
"optional": true
|
|
145
143
|
}
|
|
146
144
|
},
|
|
147
145
|
"resolutions": {
|
|
148
|
-
"@cucumber/cucumber": "11.0
|
|
146
|
+
"@cucumber/cucumber": "11.1.0",
|
|
149
147
|
"@nuxt/devtools": "1.0.8",
|
|
150
|
-
"@nuxt/kit": "^3.
|
|
151
|
-
"@nuxt/schema": "^3.
|
|
148
|
+
"@nuxt/kit": "^3.14.1592",
|
|
149
|
+
"@nuxt/schema": "^3.14.1592",
|
|
152
150
|
"@nuxt/test-utils": "workspace:*",
|
|
153
|
-
"rollup": "4.
|
|
154
|
-
"vite": "5.4.
|
|
155
|
-
"vite-node": "2.1.
|
|
156
|
-
"vitest": "2.1.
|
|
157
|
-
"vue": "^3.5.
|
|
151
|
+
"rollup": "4.28.0",
|
|
152
|
+
"vite": "5.4.11",
|
|
153
|
+
"vite-node": "2.1.8",
|
|
154
|
+
"vitest": "2.1.8",
|
|
155
|
+
"vue": "^3.5.13"
|
|
158
156
|
},
|
|
159
157
|
"engines": {
|
|
160
|
-
"node": "
|
|
158
|
+
"node": "^18.20.4 || ^20.9.0 || ^22.0.0 || >=23.0.0"
|
|
161
159
|
},
|
|
162
|
-
"packageManager": "pnpm@9.
|
|
160
|
+
"packageManager": "pnpm@9.14.4"
|
|
163
161
|
}
|