@nuxt/test-utils-nightly 3.21.1-20251211-185233-9800099 → 3.21.1-20251215-133842-059988f

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.
Files changed (2) hide show
  1. package/dist/module.mjs +26 -17
  2. package/package.json +11 -11
package/dist/module.mjs CHANGED
@@ -297,26 +297,33 @@ async function setupImportMocking(nuxt) {
297
297
 
298
298
  const PLUGIN_NAME = "nuxt:vitest:nuxt-root-stub";
299
299
  const STUB_ID = "nuxt-vitest-app-entry";
300
- const NuxtRootStubPlugin = createUnplugin((options) => {
301
- const STUB_ID_WITH_EXT = STUB_ID + extname(options.entry);
300
+ const NuxtRootStubPlugin = (options) => {
301
+ const extension = extname(options.entry);
302
+ const escapedExt = extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
303
+ const entryPath = join(dirname(options.entry), STUB_ID + extension);
304
+ const idFilter = new RegExp(`${STUB_ID}(?:${escapedExt})?$`);
302
305
  return {
303
306
  name: PLUGIN_NAME,
304
307
  enforce: "pre",
305
- vite: {
306
- async resolveId(id, importer) {
307
- if (id.endsWith(STUB_ID) || id.endsWith(STUB_ID_WITH_EXT)) {
308
- return importer?.endsWith("index.html") ? id : join(dirname(options.entry), STUB_ID_WITH_EXT);
309
- }
308
+ resolveId: {
309
+ filter: {
310
+ id: idFilter
310
311
  },
311
- async load(id) {
312
- if (id.endsWith(STUB_ID) || id.endsWith(STUB_ID_WITH_EXT)) {
313
- const entryContents = readFileSync(options.entry, "utf-8");
314
- return entryContents.replace("#build/root-component.mjs", options.rootStubPath);
315
- }
312
+ async handler(id, importer) {
313
+ return importer?.endsWith("index.html") ? id : entryPath;
314
+ }
315
+ },
316
+ load: {
317
+ filter: {
318
+ id: idFilter
319
+ },
320
+ async handler() {
321
+ const entryContents = readFileSync(options.entry, "utf-8");
322
+ return entryContents.replace("#build/root-component.mjs", options.rootStubPath);
316
323
  }
317
324
  }
318
325
  };
319
- });
326
+ };
320
327
 
321
328
  const vitePluginBlocklist = ["vite-plugin-vue-inspector", "vite-plugin-vue-inspector:post", "vite-plugin-inspect", "nuxt:type-check"];
322
329
  const module$1 = defineNuxtModule({
@@ -334,10 +341,12 @@ const module$1 = defineNuxtModule({
334
341
  }
335
342
  const { addVitePlugin } = await loadKit(nuxt.options.rootDir);
336
343
  const resolver = createResolver(import.meta.url);
337
- addVitePlugin(NuxtRootStubPlugin.vite({
338
- entry: await resolvePath("#app/entry", { alias: nuxt.options.alias }),
339
- rootStubPath: await resolvePath(resolver.resolve("./runtime/nuxt-root"))
340
- }));
344
+ if (nuxt.options.test || nuxt.options.dev) {
345
+ addVitePlugin(NuxtRootStubPlugin({
346
+ entry: await resolvePath("#app/entry", { alias: nuxt.options.alias }),
347
+ rootStubPath: await resolvePath(resolver.resolve("./runtime/nuxt-root"))
348
+ }));
349
+ }
341
350
  if (!nuxt.options.test && !nuxt.options.dev) {
342
351
  nuxt.options.vite.define ||= {};
343
352
  nuxt.options.vite.define["import.meta.vitest"] = "undefined";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/test-utils-nightly",
3
- "version": "3.21.1-20251211-185233-9800099",
3
+ "version": "3.21.1-20251215-133842-059988f",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/test-utils.git"
@@ -94,10 +94,10 @@
94
94
  "vue": "^3.5.25"
95
95
  },
96
96
  "devDependencies": {
97
- "@cucumber/cucumber": "12.3.0",
97
+ "@cucumber/cucumber": "12.4.0",
98
98
  "@jest/globals": "30.2.0",
99
99
  "@nuxt/devtools-kit": "2.7.0",
100
- "@nuxt/eslint-config": "1.11.0",
100
+ "@nuxt/eslint-config": "1.12.1",
101
101
  "@nuxt/schema": "4.2.1",
102
102
  "@playwright/test": "1.57.0",
103
103
  "@testing-library/vue": "8.1.0",
@@ -109,9 +109,9 @@
109
109
  "@vue/test-utils": "2.4.6",
110
110
  "changelogen": "0.6.2",
111
111
  "compatx": "0.2.0",
112
- "eslint": "9.39.1",
112
+ "eslint": "9.39.2",
113
113
  "installed-check": "9.3.0",
114
- "knip": "5.72.0",
114
+ "knip": "5.73.4",
115
115
  "nitropack": "2.12.9",
116
116
  "nuxt": "4.2.1",
117
117
  "pkg-pr-new": "0.0.62",
@@ -120,11 +120,11 @@
120
120
  "semver": "7.7.3",
121
121
  "typescript": "5.9.3",
122
122
  "unbuild": "latest",
123
- "unimport": "5.5.0",
124
- "vite": "7.2.7",
123
+ "unimport": "5.6.0",
124
+ "vite": "7.3.0",
125
125
  "vitest": "3.2.4",
126
- "vue-router": "4.6.3",
127
- "vue-tsc": "3.1.7"
126
+ "vue-router": "4.6.4",
127
+ "vue-tsc": "3.1.8"
128
128
  },
129
129
  "peerDependencies": {
130
130
  "@cucumber/cucumber": "^10.3.1 || >=11.0.0",
@@ -170,12 +170,12 @@
170
170
  }
171
171
  },
172
172
  "resolutions": {
173
- "@cucumber/cucumber": "12.3.0",
173
+ "@cucumber/cucumber": "12.4.0",
174
174
  "@nuxt/schema": "4.2.1",
175
175
  "@nuxt/test-utils": "workspace:*",
176
176
  "@types/node": "24.10.1",
177
177
  "rollup": "4.53.3",
178
- "vite": "7.2.7",
178
+ "vite": "7.3.0",
179
179
  "vite-node": "5.2.0",
180
180
  "vitest": "3.2.4",
181
181
  "vue": "^3.5.25"