vitest/consistent-test-filename

March 1, 2026 ยท View on GitHub

๐Ÿ“ Require test file pattern.

โš ๏ธ This rule warns in the ๐ŸŒ all config.

Rule Details

Options

NameDescriptionType
allTestPatternRegex pattern used to identify all possible test files.String
patternRegex pattern for files that should be treated as tests.String
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "pattern": {
      "format": "regex",
      "default": ".*\\.test\\.[tj]sx?$"
    },
    "allTestPattern": {
      "format": "",
      "default": ".*\\.(test|spec)\\.[tj]sx?$"
    }
  }
}
allTestPattern

regex pattern for all tests files

Decides whether a file is a testing file.

pattern

required testing pattern

pattern doesn't have a default value, you must provide one.