Skip to content

Commit

Permalink
fix: clean up wrappers when calling renderSuspended
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Dec 5, 2023
1 parent 8a6a052 commit 5b18911
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/app-vitest-full/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/runtime-utils/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export async function renderSuspended<T>(
const { vueApp } = globalThis.__unctx__.get('nuxt-app').tryUse()
const { render, setup } = component as DefineComponent<any, any>

// cleanup previously mounted test wrappers
document.querySelector(`#${WRAPPER_EL_ID}`)?.remove()

let setupContext: SetupContext

return new Promise<ReturnType<typeof renderFromTestingLibrary>>(resolve => {
Expand Down

0 comments on commit 5b18911

Please sign in to comment.