Skip to content

Support for unit testing in nuxt environment #14972

@tobiasdiez

Description

@tobiasdiez

Describe the feature

Unit testing (e.g. [parts of ]composables or server functions) doesn't require a full built of nuxt.

Originally posted by @pi0 in vitest-dev/vitest#2044 (comment)

We plan to support also unit testing with nuxi test but properly in a Nuxt environment. Exposing vite config only is not enough for doing that and in past similar approach made lots of headaches for testing in Nuxt 2. However, probably will expose as a @nuxt/kit utility anyway as an alternative to current usage that needs replicating vite config for aliases.

Related: https://github.com/nuxt/nuxt.js/issues/13077 (auto-import issues when testing components)

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

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