-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Feature Request: Extensible VCS Adapter System for Changed Test Detection #9863
Copy link
Copy link
Closed
Copy link
Labels
enhancement: pending triagep2-to-be-discussedEnhancement under consideration (priority)Enhancement under consideration (priority)
Description
Clear and concise description of the problem
Summary:
Add a plugin/extension point system to Vitest to support custom VCS (Version Control System) commands for detecting changed files. This is essential for efficiently running tests in large monorepos that use VCS systems other than Git (e.g., Mercurial, SVN) or require custom change-detection logic.
Problem:
Currently, Vitest's --changed flag and related functionality rely on Git to determine which files have been modified. This creates limitations for developers in enterprise environments where:
- Legacy codebases use Mercurial (hg), Subversion (svn), or other VCS systems
- Custom version control systems or proprietary solutions are in use
- The default Git-based change detection doesn't work with alternative VCS workflows
- Large monorepos require specialized change detection logic for optimal performance
Suggested solution
Implementation Details:
- Configuration Option: Add a
vcsCommandfield in Vitest configuration:
export default defineConfig({
vcsCommand: 'hg status --modified --added --no-status --print0 | xargs -0'
})- Standard Interface: The custom command should output changed file paths (relative to project root), one per line, to stdout.
- Fallback Behavior: Maintain current Git-based detection as default when no custom command is specified.
- Environment Variables: Support dynamic command configuration through environment variables for CI/CD flexibility.
Example Usage:
For Mercurial users:
export default defineConfig({
vcsCommand: 'hg status --modified --added --no-status'
})
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancement: pending triagep2-to-be-discussedEnhancement under consideration (priority)Enhancement under consideration (priority)
Type
Projects
Status
P2 - 2