From 5b189115b1a719091ef10bf1f1a67cbc24f0a928 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 5 Dec 2023 14:37:32 +0000 Subject: [PATCH] fix: clean up wrappers when calling `renderSuspended` --- examples/app-vitest-full/nuxt.config.ts | 1 + src/runtime-utils/render.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/examples/app-vitest-full/nuxt.config.ts b/examples/app-vitest-full/nuxt.config.ts index 407028c2a..d3b9d4ee1 100644 --- a/examples/app-vitest-full/nuxt.config.ts +++ b/examples/app-vitest-full/nuxt.config.ts @@ -1,5 +1,6 @@ // https://v3.nuxtjs.org/api/configuration/nuxt.config export default defineNuxtConfig({ + devtools: { enabled: true }, modules: ['@nuxt/test-utils/module', '~/modules/custom'], vitest: { startOnBoot: true, diff --git a/src/runtime-utils/render.ts b/src/runtime-utils/render.ts index 5ce84388d..7e4551c36 100644 --- a/src/runtime-utils/render.ts +++ b/src/runtime-utils/render.ts @@ -71,6 +71,9 @@ export async function renderSuspended( const { vueApp } = globalThis.__unctx__.get('nuxt-app').tryUse() const { render, setup } = component as DefineComponent + // cleanup previously mounted test wrappers + document.querySelector(`#${WRAPPER_EL_ID}`)?.remove() + let setupContext: SetupContext return new Promise>(resolve => {