Skip to content

Commit 4d97433

Browse files
committed
fix: patch @nuxt/test-utils structuredClone for cross-context objects
Vite's module runner creates objects in a separate V8 context that structuredClone rejects. Replace with JSON roundtrip in test-utils config resolution until upstream nuxt-site-config fix is published.
1 parent ebe0a5b commit 4d97433

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

patches/@nuxt__test-utils.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/dist/config.mjs b/dist/config.mjs
2+
index 41a73e237a7ecd0c63985421737f3cf0782391ee..56c9e2ca1dfade16afb10d90cebe43803063f837 100644
3+
--- a/dist/config.mjs
4+
+++ b/dist/config.mjs
5+
@@ -128,7 +128,7 @@ async function getVitestConfigFromNuxt(options, loadNuxtOptions = {}) {
6+
},
7+
test: {
8+
environmentOptions: {
9+
- nuxtRuntimeConfig: applyEnv(structuredClone(options.nuxt.options.runtimeConfig), {
10+
+ nuxtRuntimeConfig: applyEnv(JSON.parse(JSON.stringify(options.nuxt.options.runtimeConfig)), {
11+
prefix: "NUXT_",
12+
env: await setupDotenv(defu(loadNuxtOptions.dotenv, {
13+
cwd: rootDir,

pnpm-lock.yaml

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ packageExtensions:
4343

4444
patchedDependencies:
4545
'@jsr/deno__doc@0.189.1': patches/@jsr__deno__doc@0.189.1.patch
46+
'@nuxt/test-utils': patches/@nuxt__test-utils.patch
4647

4748
savePrefix: ''
4849

0 commit comments

Comments
 (0)