Skip to main content

avoid-missing-test-files

added in: 1.11.0
⚙️

Configure a list of files that should have a corresponding test file.

This rule assumes your test folder structure matches your lib folder structure.

caution

This rule relies on file system calls and can be slow on large number of files.

⚙️ Config

Set patterns (default is empty, can contain a regular expression) to configure the list of paths for the rule to trigger on.

dart_code_metrics:
...
rules:
...
- avoid-missing-test-files:
patterns:
- all/my/*.models.dart
- some/other/file.dart
note

This rule requires configuration in order to highlight any issues.

Example

❌ Bad:

// package/lib/src/my_file.dart
// no test file // LINT

✅ Good:

// package/lib/src/my_file.dart
// package/test/src/my_file_test.dart