Skip to content
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

Vue provide/inject is not testable in components #539

Closed
oskarols opened this issue Aug 3, 2023 · 1 comment · Fixed by #663
Closed

Vue provide/inject is not testable in components #539

oskarols opened this issue Aug 3, 2023 · 1 comment · Fixed by #663
Labels
documentation Improvements or additions to documentation pending triage vitest-environment

Comments

@oskarols
Copy link
Contributor

oskarols commented Aug 3, 2023

Hi 👋

We're experiencing issues with Nuxt plugins that utilize vueApp.provide() to inject values. Consuming those injected values in components works fine when using the dev server. However when testing with nuxt-vitest these values are not set.

We've tried to pass the nuxtApp.vueApp as localVue in the mountSuspended() options but this seems to have no effect.

I've created a failing test case for this here (diff)

The new component for the test case should look like this:

image

But in tests the content (which is the injected value) is empty.

@danielroe danielroe transferred this issue from danielroe/nuxt-vitest Dec 2, 2023
@danielroe
Copy link
Member

This workaround may help: #601 (comment)

@danielroe danielroe added pending triage documentation Improvements or additions to documentation labels Dec 2, 2023
danielroe added a commit that referenced this issue Dec 19, 2023
resolves #539

Co-authored-by: Oskar Olsson <oskar.olsson@backmarket.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation pending triage vitest-environment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants