@nuxt/test-utils-nightly 3.21.1-20251205-165502-79f1e14 → 3.21.1-20251209-162440-1148c3c
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.
|
@@ -3,5 +3,11 @@ export async function setupNuxt() {
|
|
|
3
3
|
await import("#app/nuxt-vitest-app-entry").then((r) => r.default());
|
|
4
4
|
const nuxtApp = useNuxtApp();
|
|
5
5
|
await nuxtApp.callHook("page:finish");
|
|
6
|
-
useRouter().afterEach(() =>
|
|
6
|
+
useRouter().afterEach(() => {
|
|
7
|
+
if ("sync" in nuxtApp._route) {
|
|
8
|
+
nuxtApp._route.sync?.();
|
|
9
|
+
} else {
|
|
10
|
+
return nuxtApp.callHook("page:finish");
|
|
11
|
+
}
|
|
12
|
+
});
|
|
7
13
|
}
|
|
@@ -2,7 +2,7 @@ import { defineEventHandler } from 'h3';
|
|
|
2
2
|
import { mount } from '@vue/test-utils';
|
|
3
3
|
import { reactive, h as h$1, Suspense, nextTick, getCurrentInstance, effectScope, defineComponent as defineComponent$1 } from 'vue';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
|
-
import { defineComponent, useRouter, h, tryUseNuxtApp } from '#imports';
|
|
5
|
+
import { defineComponent, useRouter, h, tryUseNuxtApp, onErrorCaptured } from '#imports';
|
|
6
6
|
import NuxtRoot from '#build/root-component.mjs';
|
|
7
7
|
|
|
8
8
|
const endpointRegistry = {};
|
|
@@ -143,7 +143,8 @@ async function mountSuspended(component, options) {
|
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
return new Promise(
|
|
146
|
-
(resolve) => {
|
|
146
|
+
(resolve, reject) => {
|
|
147
|
+
let isMountSettled = false;
|
|
147
148
|
const vm = mount(
|
|
148
149
|
{
|
|
149
150
|
__cssModules: componentRest.__cssModules,
|
|
@@ -152,29 +153,43 @@ async function mountSuspended(component, options) {
|
|
|
152
153
|
patchInstanceAppContext();
|
|
153
154
|
wrappedInstance = getCurrentInstance();
|
|
154
155
|
setupContext = ctx;
|
|
156
|
+
let nuxtRootSetupResult;
|
|
155
157
|
if (options?.scoped) {
|
|
156
158
|
const scope = effectScope();
|
|
157
159
|
globalThis.__cleanup ||= [];
|
|
158
160
|
globalThis.__cleanup.push(() => {
|
|
159
161
|
scope.stop();
|
|
160
162
|
});
|
|
161
|
-
|
|
163
|
+
nuxtRootSetupResult = scope.run(() => NuxtRoot.setup(props2, {
|
|
162
164
|
...ctx,
|
|
163
165
|
expose: () => {
|
|
164
166
|
}
|
|
165
167
|
}));
|
|
166
168
|
} else {
|
|
167
|
-
|
|
169
|
+
nuxtRootSetupResult = NuxtRoot.setup(props2, {
|
|
168
170
|
...ctx,
|
|
169
171
|
expose: () => {
|
|
170
172
|
}
|
|
171
173
|
});
|
|
172
174
|
}
|
|
175
|
+
onErrorCaptured((error, ...args) => {
|
|
176
|
+
if (isMountSettled) return;
|
|
177
|
+
isMountSettled = true;
|
|
178
|
+
try {
|
|
179
|
+
wrappedInstance?.appContext.config.errorHandler?.(error, ...args);
|
|
180
|
+
reject(error);
|
|
181
|
+
} catch (error2) {
|
|
182
|
+
reject(error2);
|
|
183
|
+
}
|
|
184
|
+
return false;
|
|
185
|
+
});
|
|
186
|
+
return nuxtRootSetupResult;
|
|
173
187
|
},
|
|
174
188
|
render: () => h$1(
|
|
175
189
|
Suspense,
|
|
176
190
|
{
|
|
177
191
|
onResolve: () => nextTick().then(() => {
|
|
192
|
+
isMountSettled = true;
|
|
178
193
|
vm.setupState = setupState;
|
|
179
194
|
vm.__setProps = (props2) => {
|
|
180
195
|
Object.assign(setProps, props2);
|
|
@@ -323,7 +338,8 @@ async function renderSuspended(component, options) {
|
|
|
323
338
|
return h$1("div", { id: WRAPPER_EL_ID }, this.$slots.default?.());
|
|
324
339
|
}
|
|
325
340
|
});
|
|
326
|
-
return new Promise((resolve) => {
|
|
341
|
+
return new Promise((resolve, reject) => {
|
|
342
|
+
let isMountSettled = false;
|
|
327
343
|
const utils = renderFromTestingLibrary(
|
|
328
344
|
{
|
|
329
345
|
__cssModules: componentRest.__cssModules,
|
|
@@ -337,10 +353,22 @@ async function renderSuspended(component, options) {
|
|
|
337
353
|
window.__cleanup.push(() => {
|
|
338
354
|
scope.stop();
|
|
339
355
|
});
|
|
340
|
-
|
|
356
|
+
const nuxtRootSetupResult = scope.run(() => NuxtRoot.setup(props2, {
|
|
341
357
|
...ctx,
|
|
342
358
|
expose: () => ({})
|
|
343
359
|
}));
|
|
360
|
+
onErrorCaptured((error, ...args) => {
|
|
361
|
+
if (isMountSettled) return;
|
|
362
|
+
isMountSettled = true;
|
|
363
|
+
try {
|
|
364
|
+
wrappedInstance?.appContext.config.errorHandler?.(error, ...args);
|
|
365
|
+
reject(error);
|
|
366
|
+
} catch (error2) {
|
|
367
|
+
reject(error2);
|
|
368
|
+
}
|
|
369
|
+
return false;
|
|
370
|
+
});
|
|
371
|
+
return nuxtRootSetupResult;
|
|
344
372
|
},
|
|
345
373
|
render: () => (
|
|
346
374
|
// See discussions in https://github.com/testing-library/vue-testing-library/issues/230
|
|
@@ -354,6 +382,7 @@ async function renderSuspended(component, options) {
|
|
|
354
382
|
Suspense,
|
|
355
383
|
{
|
|
356
384
|
onResolve: () => nextTick().then(() => {
|
|
385
|
+
isMountSettled = true;
|
|
357
386
|
utils.setupState = setupState;
|
|
358
387
|
utils.rerender = async (props2) => {
|
|
359
388
|
Object.assign(setProps, props2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/test-utils-nightly",
|
|
3
|
-
"version": "3.21.1-
|
|
3
|
+
"version": "3.21.1-20251209-162440-1148c3c",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/test-utils.git"
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"local-pkg": "^1.1.2",
|
|
81
81
|
"magic-string": "^0.30.21",
|
|
82
82
|
"node-fetch-native": "^1.6.7",
|
|
83
|
-
"node-mock-http": "^1.0.
|
|
83
|
+
"node-mock-http": "^1.0.4",
|
|
84
84
|
"ofetch": "^1.5.1",
|
|
85
85
|
"pathe": "^2.0.3",
|
|
86
86
|
"perfect-debounce": "^2.0.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"@nuxt/schema": "4.2.1",
|
|
102
102
|
"@playwright/test": "1.57.0",
|
|
103
103
|
"@testing-library/vue": "8.1.0",
|
|
104
|
-
"@types/bun": "1.3.
|
|
104
|
+
"@types/bun": "1.3.4",
|
|
105
105
|
"@types/estree": "1.0.8",
|
|
106
106
|
"@types/jsdom": "27.0.0",
|
|
107
107
|
"@types/node": "latest",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"compatx": "0.2.0",
|
|
112
112
|
"eslint": "9.39.1",
|
|
113
113
|
"installed-check": "9.3.0",
|
|
114
|
-
"knip": "5.
|
|
114
|
+
"knip": "5.72.0",
|
|
115
115
|
"nitropack": "2.12.9",
|
|
116
116
|
"nuxt": "4.2.1",
|
|
117
117
|
"pkg-pr-new": "0.0.62",
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
"typescript": "5.9.3",
|
|
122
122
|
"unbuild": "latest",
|
|
123
123
|
"unimport": "5.5.0",
|
|
124
|
-
"vite": "7.2.
|
|
124
|
+
"vite": "7.2.7",
|
|
125
125
|
"vitest": "3.2.4",
|
|
126
126
|
"vue-router": "4.6.3",
|
|
127
|
-
"vue-tsc": "3.1.
|
|
127
|
+
"vue-tsc": "3.1.7"
|
|
128
128
|
},
|
|
129
129
|
"peerDependencies": {
|
|
130
130
|
"@cucumber/cucumber": "^10.3.1 || >=11.0.0",
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
"@nuxt/test-utils": "workspace:*",
|
|
176
176
|
"@types/node": "24.10.1",
|
|
177
177
|
"rollup": "4.53.3",
|
|
178
|
-
"vite": "7.2.
|
|
178
|
+
"vite": "7.2.7",
|
|
179
179
|
"vite-node": "5.2.0",
|
|
180
180
|
"vitest": "3.2.4",
|
|
181
181
|
"vue": "^3.5.25"
|
|
@@ -183,5 +183,5 @@
|
|
|
183
183
|
"engines": {
|
|
184
184
|
"node": "^20.0.0 || ^22.0.0 || >=24.0.0"
|
|
185
185
|
},
|
|
186
|
-
"packageManager": "pnpm@10.
|
|
186
|
+
"packageManager": "pnpm@10.25.0"
|
|
187
187
|
}
|