-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
renderSuspended renders layout AND component #561
Comments
I can confirm this is still happening with Reproduction is here: |
got the same issue, any updates or plan to workaround this? |
The somewhat crude workaround we did was to add a test-specific route that doesn't render anything, and then we use that route when using Would be nice to have this officially be supported by nuxt-vitest, e.g. by having to opt-in to actually rendering the route tree and having it be a noop by default. |
I have found that this workaround appears to work https://github.com/danielroe/nuxt-vitest/issues/295#issuecomment-1714288882 if you make it so that the 'replacement' is a component that renders an empty div |
This should now be implemented - we no longer render |
I have a
NavigationBar
component that is rendered within a layout (layouts/default.vue
)I am wanting to test the NavigationBar in isolation of the rest of the page, but it contains the
NuxtLink
component so I need to test it within the context of the nuxt environment.This is rendering the page as the following:
Is this expected behaviour? In my case it is effectively rendering the
NavigationBar
twice as it's appearing with the__nuxt
div in the layout, and in thetest-wrapper
div. This makes it hard to test using@testing-library
as I can't usegetByText
but instead need to usegetAllbyText
as everything is rendered twice.vitest version
0.32.2
nuxt-vitest
0.10.5
The text was updated successfully, but these errors were encountered: