nuxt / nuxt/test-utils

App.vue doesnt mount when running tests

Open
#745 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement pending triage
Dominant language
TypeScript
Stars
437
Forks
120
Avg merge
22h 52m
Merged PRs (30d)
23

Description

Environment

[8:43:08 AM] Working directory: C:/code/nuxt-test
[8:43:08 AM] Nuxt project info:


  • Operating System: Windows_NT
  • Node Version: v20.11.0
  • Nuxt Version: 3.9.3
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: npm@10.2.4
  • Builder: -
  • User Config: devtools, modules
  • Runtime Modules: @nuxt/test-utils/module@3.11.0
  • Build Modules: -

Reproduction

https://github.com/joel-wenzel/nuxt-test
Steps to reproduce:

  1. git clone https://github.com/joel-wenzel/nuxt-test
  2. cd nuxt-test
  3. npm ci
  4. npm run test
  5. There are two console logs in app.vue that dont seem to be logged
Describe the bug

It seems like App.vue doesnt mount when using @nuxt/test-utils. This was something nuxt-vitest did do, at least version 0.11.0.
In my case I am also using vuetify and rely on some of the vuetify elements being mounted in the app which unfortunately is not happening.

Additional context

No response

Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked nuxt-test reproduction, install dependencies with npm ci, and run npm run test. Start with app.vue and the @nuxt/test-utils setup to trace why its console logs and Vuetify elements are not mounted. Done means App.vue mounts during tests and the reproduction logs appear as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxtjs, typescript
Domain
frontend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.