@nuxt/test-utils-nightly 3.21.0-20251030-161832-4f04851 → 3.21.0-20251103-141132-dc46354
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/runtime-utils/index.mjs +22 -2
- package/package.json +1 -1
|
@@ -100,7 +100,7 @@ async function mountSuspended(component, options) {
|
|
|
100
100
|
cleanupFunction();
|
|
101
101
|
}
|
|
102
102
|
const vueApp = tryUseNuxtApp()?.vueApp || globalThis.__unctx__.get("nuxt-app").tryUse().vueApp;
|
|
103
|
-
const { render, setup, data, computed, methods } = component;
|
|
103
|
+
const { render, setup, data, computed, methods, ...componentRest } = component;
|
|
104
104
|
let setupContext;
|
|
105
105
|
let setupState;
|
|
106
106
|
const setProps = reactive({});
|
|
@@ -121,6 +121,14 @@ async function mountSuspended(component, options) {
|
|
|
121
121
|
}
|
|
122
122
|
currentInstance.emit = getInterceptedEmitFunction(currentInstance.emit);
|
|
123
123
|
}
|
|
124
|
+
function patchInstanceAppContext() {
|
|
125
|
+
const app = getCurrentInstance()?.appContext.app;
|
|
126
|
+
if (!app) return;
|
|
127
|
+
for (const [key, value] of Object.entries(vueApp)) {
|
|
128
|
+
if (key in app) continue;
|
|
129
|
+
app[key] = value;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
124
132
|
let passedProps;
|
|
125
133
|
let componentScope = null;
|
|
126
134
|
const wrappedSetup = async (props2, setupContext2) => {
|
|
@@ -148,7 +156,9 @@ async function mountSuspended(component, options) {
|
|
|
148
156
|
(resolve) => {
|
|
149
157
|
const vm = mount(
|
|
150
158
|
{
|
|
159
|
+
__cssModules: componentRest.__cssModules,
|
|
151
160
|
setup: (props2, ctx) => {
|
|
161
|
+
patchInstanceAppContext();
|
|
152
162
|
setupContext = ctx;
|
|
153
163
|
if (options?.scoped) {
|
|
154
164
|
const scope = effectScope();
|
|
@@ -331,7 +341,7 @@ async function renderSuspended(component, options) {
|
|
|
331
341
|
} = options || {};
|
|
332
342
|
const { render: renderFromTestingLibrary } = await import('@testing-library/vue');
|
|
333
343
|
const vueApp = tryUseNuxtApp()?.vueApp || globalThis.__unctx__.get("nuxt-app").tryUse().vueApp;
|
|
334
|
-
const { render, setup, data, computed, methods } = component;
|
|
344
|
+
const { render, setup, data, computed, methods, ...componentRest } = component;
|
|
335
345
|
let setupContext;
|
|
336
346
|
let setupState;
|
|
337
347
|
const setProps = reactive({});
|
|
@@ -352,6 +362,14 @@ async function renderSuspended(component, options) {
|
|
|
352
362
|
}
|
|
353
363
|
currentInstance.emit = getInterceptedEmitFunction(currentInstance.emit);
|
|
354
364
|
}
|
|
365
|
+
function patchInstanceAppContext() {
|
|
366
|
+
const app = getCurrentInstance()?.appContext.app;
|
|
367
|
+
if (!app) return;
|
|
368
|
+
for (const [key, value] of Object.entries(vueApp)) {
|
|
369
|
+
if (key in app) continue;
|
|
370
|
+
app[key] = value;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
355
373
|
for (const fn of window.__cleanup || []) {
|
|
356
374
|
fn();
|
|
357
375
|
}
|
|
@@ -375,7 +393,9 @@ async function renderSuspended(component, options) {
|
|
|
375
393
|
return new Promise((resolve) => {
|
|
376
394
|
const utils = renderFromTestingLibrary(
|
|
377
395
|
{
|
|
396
|
+
__cssModules: componentRest.__cssModules,
|
|
378
397
|
setup: (props2, ctx) => {
|
|
398
|
+
patchInstanceAppContext();
|
|
379
399
|
setupContext = ctx;
|
|
380
400
|
const scope = effectScope();
|
|
381
401
|
window.__cleanup ||= [];
|