Skip to content

Feature Request: Extensible VCS Adapter System for Changed Test Detection #9863

Description

@MrMeison

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:

  1. Configuration Option: Add a vcsCommand field in Vitest configuration:
export default defineConfig({
  vcsCommand: 'hg status --modified --added --no-status --print0 | xargs -0'
})
  1. Standard Interface: The custom command should output changed file paths (relative to project root), one per line, to stdout.

  2. Fallback Behavior: Maintain current Git-based detection as default when no custom command is specified.
  3. 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

Activity

  1. added theissue type on Mar 14, 2026
  2. sheremet-va commented on Mar 14, 2026

    @sheremet-va
    Member

    I think we could expose a way to specify your own VSC "provider". In the builtin git one we only have a single public method:

    class VCSProvider {
      findChangedFiles(options: { cwd: string, changedSince?: string | boolean }): Promise<string[] | null>
    }

    Similarly like we do with the sequencer, for example:

    export default defineConfig({
      test: {
        vcsProvider: CustomVCSProvider,
      },
    })

    Or better just an object with that field:

    export default defineConfig({
      test: {
        vcsProvider: new CustomVCSProvider(),
      },
    })
  3. added
    p2-to-be-discussed
    on Mar 14, 2026
  4. moved this to P2 - 2 in Team Boardon Mar 14, 2026
  5. locked and limited conversation to collaborators on Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: pending triagep2-to-be-discussed

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions