@nuxt/test-utils-nightly 3.21.1-20251231-214547-c19a659 → 3.21.1-20251231-223528-2b3c869
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.mjs +20 -16
- package/dist/e2e.mjs +13 -9
- package/package.json +1 -1
package/dist/config.mjs
CHANGED
|
@@ -9,6 +9,25 @@ import 'scule';
|
|
|
9
9
|
import 'node:url';
|
|
10
10
|
import 'exsolve';
|
|
11
11
|
|
|
12
|
+
const PLUGIN_NAME = "nuxt:vitest:nuxt-environment-options";
|
|
13
|
+
const STUB_ID = "nuxt-vitest-environment-options";
|
|
14
|
+
function NuxtVitestEnvironmentOptionsPlugin(environmentOptions = {}) {
|
|
15
|
+
return {
|
|
16
|
+
name: PLUGIN_NAME,
|
|
17
|
+
enforce: "pre",
|
|
18
|
+
resolveId(id) {
|
|
19
|
+
if (id.endsWith(STUB_ID)) {
|
|
20
|
+
return STUB_ID;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
load(id) {
|
|
24
|
+
if (id.endsWith(STUB_ID)) {
|
|
25
|
+
return `export default ${JSON.stringify(environmentOptions || {})}`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
12
31
|
async function startNuxtAndGetViteConfig(rootDir = process.cwd(), options = {}) {
|
|
13
32
|
const { buildNuxt, loadNuxt } = await loadKit(rootDir);
|
|
14
33
|
const nuxt = await loadNuxt({
|
|
@@ -253,22 +272,7 @@ async function resolveConfig(config) {
|
|
|
253
272
|
overrides: structuredClone(overrides)
|
|
254
273
|
})
|
|
255
274
|
);
|
|
256
|
-
|
|
257
|
-
const STUB_ID = "nuxt-vitest-environment-options";
|
|
258
|
-
resolvedConfig.plugins.push({
|
|
259
|
-
name: PLUGIN_NAME,
|
|
260
|
-
enforce: "pre",
|
|
261
|
-
resolveId(id) {
|
|
262
|
-
if (id.endsWith(STUB_ID)) {
|
|
263
|
-
return STUB_ID;
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
load(id) {
|
|
267
|
-
if (id.endsWith(STUB_ID)) {
|
|
268
|
-
return `export default ${JSON.stringify(resolvedConfig.test.environmentOptions || {})}`;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
});
|
|
275
|
+
resolvedConfig.plugins.push(NuxtVitestEnvironmentOptionsPlugin(resolvedConfig.test.environmentOptions));
|
|
272
276
|
if (resolvedConfig.test.browser?.enabled) {
|
|
273
277
|
if (resolvedConfig.test.environment === "nuxt") {
|
|
274
278
|
resolvedConfig.test.setupFiles = Array.isArray(resolvedConfig.test.setupFiles) ? resolvedConfig.test.setupFiles : [resolvedConfig.test.setupFiles].filter(Boolean);
|
package/dist/e2e.mjs
CHANGED
|
@@ -52,8 +52,10 @@ async function runTests(opts) {
|
|
|
52
52
|
{
|
|
53
53
|
root: opts.rootDir,
|
|
54
54
|
run: !opts.watch,
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
server: {
|
|
56
|
+
deps: {
|
|
57
|
+
inline: [/@nuxt\/test-utils/]
|
|
58
|
+
}
|
|
57
59
|
}
|
|
58
60
|
},
|
|
59
61
|
// Vite options
|
|
@@ -63,13 +65,15 @@ async function runTests(opts) {
|
|
|
63
65
|
},
|
|
64
66
|
test: {
|
|
65
67
|
dir: opts.rootDir,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
server: {
|
|
69
|
+
deps: {
|
|
70
|
+
inline: [
|
|
71
|
+
distDir,
|
|
72
|
+
"@nuxt/test-utils",
|
|
73
|
+
"@nuxt/test-utils-nightly",
|
|
74
|
+
"@nuxt/test-utils-edge"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
73
77
|
},
|
|
74
78
|
globals: true,
|
|
75
79
|
globalSetup: [
|