Skip to content

feat(cli): complete test commands and options from Vitest metadata - #3190

Open
RSS1102 wants to merge 3 commits into
voidzero-dev:mainfrom
RSS1102:feat/vitest-cli-completion
Open

RSS1102 wants to merge 3 commits into
voidzero-dev:mainfrom
RSS1102:feat/vitest-cli-completion

Conversation

@RSS1102

@RSS1102 RSS1102 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Related to #2953. Based on the createCLI() approach discussed with Vitest.

Implementation

  1. Generate at build time: read the public command and option definitions from vitest/node.createCLI() and package them as dist/completion/test.json.
  2. Follow the selected toolchain: prefer the runnable project-local Vite+ package, including the directory selected by -C; use the global package when no runnable local CLI exists.
  3. Complete in Rust: read and validate the packaged metadata without starting Node.js, loading project configuration, or triggering installation. Missing, invalid, unsupported, or version-mismatched metadata falls back to the existing completion behavior.

Capabilities

Area Support
Shells Bash, Zsh, Fish, and PowerShell through vp env setup
Commands Implicit vp test and run, watch, dev, related, bench, list, doctor
Options Long names, short aliases, negative spellings (--no-color), and nested options (--coverage.reporter)
Scope and descriptions Command-specific options and descriptions, displayed where supported by the shell
Argument handling Options after file filters; required/optional value positions and -- respected

Examples: vp test --reporte<Tab> → --reporter; vp test list --filesO<Tab> → --filesOnly.

Support boundary

  • Both the global CLI and selected Vite+ package need a build containing this feature. No extra Vitest configuration is required.
  • Support follows Vite+'s paired Vitest 5.x toolchain, currently validated with 5.0.5. Each paired dependency upgrade is checked by contract and consumer tests; arbitrary Vitest replacements are outside this guarantee.
  • Older toolchains without matching metadata, including Vitest 3/4 fallback cases, retain the original completion behavior.
  • Command and option-name completion only: this first implementation follows Vite+'s existing shell completion behavior. It does not provide Vitest option-value candidates (such as reporter or environment names), test/project names, or init/complete expansion. Nushell changes and test execution compatibility are outside this PR.

@RSS1102
RSS1102 force-pushed the feat/vitest-cli-completion branch from 67aab9c to fb794e5 Compare October 24, 2026 21:17
@RSS1102
RSS1102 marked this pull request as ready for review October 29, 2026 11:02
@RSS1102

RSS1102 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

@liangmiQwQ @fengmk2 cc

@liangmiQwQ
liangmiQwQ self-requested a review October 29, 2026 12:35

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant