Skip to content

Commit

Permalink
fix(vitest-environment-nuxt): import @testing-library/vue within `r…
Browse files Browse the repository at this point in the history
…enderSuspended` (nuxt#331)
  • Loading branch information
huang-julien committed Sep 12, 2023
1 parent cdff550 commit 5fe565d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/vitest-environment-nuxt/runtime/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import {
h,
nextTick,
} from 'vue'

import {
type RenderOptions as TestingLibraryRenderOptions,
render as renderFromTestingLibrary,
import type {
RenderOptions as TestingLibraryRenderOptions,
} from '@testing-library/vue'
import { defu } from 'defu'
import type { RouteLocationRaw } from 'vue-router'
Expand Down Expand Up @@ -68,6 +66,8 @@ export async function renderSuspended<T>(
..._options
} = options || {}

const { render : renderFromTestingLibrary } = await import('@testing-library/vue')

// @ts-ignore untyped global __unctx__
const { vueApp } = globalThis.__unctx__.get('nuxt-app').tryUse()
const { render, setup } = component as DefineComponent<any, any>
Expand Down

0 comments on commit 5fe565d

Please sign in to comment.