feat: add a built-output smoke test command (`nuxt preview --smoke`)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- bun, node.js, typescript
Research direction
Read the existing nuxt preview command and the described ~550-line Bun smoke script to map how the built server is started and checked. Then trace how the CLI resolves the .output entry and handles environment and signals across runtimes. Done means a smoke command checks HTTP expectations and shutdown, exits nonzero on failure, and leaves no server process running.
Written by the indexing model from the issue text.
Description
nuxt preview starts .output/server/index.mjs, but it does not verify that the built output:
- boots with the production environment,
- serves the shell and all required assets/chunks,
- starts with the intended runtime (Bun or Node),
- runs Nitro
closehooks and exits cleanly onSIGTERM/SIGINT.
nuxt build can pass while the deploy fails at runtime: a missing secret, a wrong database path, a missing asset, a preset regression (for example the Bun preset skipping close hooks), or a shutdown that hangs. We currently maintain a ~550-line smoke script for this.
What our script does:
- reserves a free port, creates temporary SQLite databases, and applies migrations;
- builds a minimal environment instead of inheriting the developer
.env; - spawns
.output/server/index.mjswith Bun; - waits for HTTP 200 and a known shell marker, and scans captured logs for forbidden content;
- sends
SIGTERM, asserts exit within 15 seconds and clean shutdown; on Windows it records that Bun'sSIGTERMis termination-only; - is the last step of
check -> build -> built-output Playwright -> smoke.
Proposal: nuxt preview --smoke (or nuxt build --smoke) with:
--url/--expectfor a path plus expected status and optional body marker;--timeoutand--signal;--env-fileor--envfor a minimal production environment;- an assertion that the process exits after the signal, optionally checking a close-hook marker;
- a non-zero exit on failure, and no server process left behind;
- support for the current runtime and
.outputlayout without hard-coding Nitro internals.
What exists today:
nuxt previewstarts the server but makes no assertions.@nuxt/test-utilsis excellent for tests that call the server, but it does not own the built process lifecycle or shutdown assertions.- Nitro close hooks are usually tested manually or with a custom script.
This could be a module, but a CLI command is the right home because it must know the output entry, environment loading and signal semantics. Happy to contribute the command or a shared helper. Our script is Bun-specific today; cross-platform signal handling is the main design work.
Additional information
- Would you be willing to help implement this feature?
- Could this feature be implemented as a module?
- Dominant language
- TypeScript
- Stars
- 402
- Forks
- 125
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 37
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from nuxt/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
dev: false "reachable from the network" warning when `devServer.host` is a `*.localhost` subdomainMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
Similar issues
-
bug priority: low role: BE stage: now
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
ahmadrosid/nakama#2594 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
milind-soni/OpenMausBot#6495 ·
Maintainers usually reply within 1 day
-
Navigating the session tree adds the branch's prompts to Up-arrow history againPossibly taken @acmerfight claimed this today. Openuntriaged
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
earendil-works/pi#12279 ·
Maintainers usually reply within 1 day
-
approved documentation
Difficulty 1/5 Under an hour Newbie friendliness 89/100
vitest-dev/vitest#12015 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100