Skip to main content

prefer-correct-test-file-name

added in: 1.6.0
preset: recommended

Warns if a file within /test folder contains a main function, but the file name doesn't end with _test.dart.

Example

❌ Bad:

File name: some_file.dart

void main() {
...
}

✅ Good:

File name: some_file_test.dart

void main() {
...
}

File name: some_other_file.dart

void helperFunction() {
...
}