Skip to main content

prefer-correct-test-file-name

added in: 4.19.0
warning

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

note

If you want to set exclude config for this rule, the default ['/**', '!test/**'] will be overriden.

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() {
...
}