Skip to content

Vue provide/inject is not testable in components #539

@oskarols

Description

@oskarols

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions