Skip to content

injection "Symbol(nuxt-ui.locale-context)" not found in Vitest with mountSuspended #4579

@smudgygee

Description

@smudgygee

Environment

Is this bug related to Nuxt or Vue?

Nuxt

Version

v3.17.7

Reproduction

https://codesandbox.io/p/devbox/stupefied-buck-v32fmk

Description

When testing components that utilize Nuxt UI's inputs (UInput, UInputNumber, UInputMenu) in a Vitest environment using @nuxt/test-utils's mountSuspended, a persistent warning "injection Symbol(nuxt-ui.locale-context) not found" is logged.

The warning suggests an issue with how Nuxt UI's locale context is provided or accessed within the minimal Nuxt app created by mountSuspended.

[Vue warn]: injection "Symbol(nuxt-ui.locale-context)" not found. 
  at <UInputNumber modelValue=100 onUpdate:modelValue=fn modelModifiers= { number: true }  ... > 
  at <Primitive as=undefined class="text-sm" > 
  at <UFormField label="price" error=undefined > 
  at <VInputNumber modelValue=100 onUpdate:modelValue=fn name="price_per_vehicle"  ... > 
  at <MountSuspendedComponent formValues= { price_per_vehicle: 100, km_per_month: 2000 } > 
  at <MountSuspendedHelper> 
  at <Anonymous ref="VTU_COMPONENT" > 
  at <VTUROOT>

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv3#1289

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions