consistent-test-filename
UnreleasedConfiguration
Rule Details
Requires every test file to be named according to a single convention. Rstest runs both *.test.* and *.spec.* files by default, so a project that mixes the two makes tests harder to locate and forces every coverage glob, CI shard, and editor filter to spell out both forms.
allTestPattern decides which files count as test files, and pattern is the convention those files have to follow. Under the defaults a *.spec.* file is a test file whose name does not match the required *.test.* form, so it is reported. Both defaults accept the .cts, .mts, .cjs, and .mjs extensions that Rstest's include glob accepts by default.
Only the path is examined, never the contents. A file named *.spec.ts is reported even when it registers no test, and a source file carrying in-source tests is never reported, because its name is an ordinary source file's name. Both patterns are matched against the whole path rather than the basename, so a pattern such as __tests__ can select an entire directory. The diagnostic is reported at the start of the file.