Tests running in a GH action sharing a nuxt server a bit faster
Nobody has claimed this yet.
- 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
- Read the contribution guide.
- Check existing discussions and issues.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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