nuxt / nuxt/test-utils

Ability to avoid a new nuxt instance for each test file

Open
#923 0 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

Describe the feature

I have a project where I've written multiple test files, each with their own setup() inside the top describe()

describe('/api/pen', async () => {
  await setup(setupConfig())
...

When I run these tests it creates a nuxt instance for each test file, demonstrated here: https://github.com/fumeapp/bio/actions/runs/10505024117/job/29101731333#step:12:48

I'm not sure if I have this setup incorrectly, or maybe if there was a way to have all test files share the same nuxt instance?

P.S. I am working on a potential GH action version that will run nuxt in the background and allow a possible setup({host: ...}) version, if i get this working i'll share it.

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

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

Start by examining how setup() initializes Nuxt for each test file and reproduce the behavior with the linked project or workflow run. Define how multiple test files can share one Nuxt instance while retaining their setup() calls, then verify the approach with the test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.