Skip to content

🐛 @nuxt/test-utils causes Unlisted Dependency warnings in vitest.config.ts #1832

Description

@yschroe

Prerequisites

Reproduction url

https://stackblitz.com/edit/github-zgkdats5

Reproduction access

  • I've made sure the reproduction is publicly accessible

Description of the issue

Hello,

since v6.21.0 using nuxt test-utils' defineVitestProject in vitest.config.ts to setup the nuxt test environment results in knip listing a few packages as "Unlisted Dependencies". Those packages are dependencies of dependencies, e.g. "@iconify/vue" as a dependency of "@nuxt/ui" (which is a direct dependency of the project).

The vitest.config.ts is set-up as described in the nuxt docs here: https://nuxt.com/docs/4.x/getting-started/testing#setup. If I comment out the await defineVitestProject part, knip no longer marks those dependencies as unlisted.

In the repro only "@iconify/vue" is listed, but in my real project the same set-up causes more "Unlisted Dependency" warnings for packages like "@unovis/vue", "@unovis/ts" and "vue-chrts".

Note: The unlisted dependency warning for "vitest-environment-nuxt" was showing up in other versions as well and is unrelated to this new behaviour.

Analyzing workspace…
Unlisted dependencies (2)
vitest-environment-nuxt  vitest.config.ts
@iconify/vue             vitest.config.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions