nuxt / nuxt/test-utils

Tests running in a GH action sharing a nuxt server a bit faster

Open
#925 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the feature

In my current Nuxt project I have 6 test files each testing about 8-10 endpoints, each file currently spins up its own nuxt instance making the entire action require about 10 minutes to run, and vitest itself taking 8m 46s

So I tweaked my GH action to instead run a nuxt server in an action in the background, and then sleep for 10 seconds to make sure it completes its run

  - name: Start Server
    run: pnpm run dev:test &
  - name: Sleep for 10 seconds
    run: sleep 10

Update: sleep no longer needed

Now instead of vitest taking 8 minutes 46 seconds, it finished in 18 seconds.

You can find the entire action file here

I found this pretty amazing so I thought I'd share starting with an issue with the questions:

  • Is there any way to improve how I'm doing this?
  • Where should we document this so the community can easily find it?

Very happy to provide a PR anywhere to help share this strategy

BTW shot out to @tobiasdiez for Making this possible

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 reading the workflow in .github/workflows/test.yml and the referenced nuxt/test-utils PR #803. Compare the current per-file Nuxt startup approach with the shared background server strategy described here, then clarify whether the outcome should be an implementation, a module, or documentation; done requires an agreed approach and guidance the community can use.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, nuxtjs, typescript
Domain
ci-cd, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.