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
vcsCommand field 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
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
--changedflag and related functionality rely on Git to determine which files have been modified. This creates limitations for developers in enterprise environments where:Suggested solution
Implementation Details:
vcsCommandfield in Vitest configuration:Example Usage:
For Mercurial users:
Alternative
No response
Additional context
No response
Validations