avoid-missing-test-files
Configure a list of files that should have a corresponding test file.
This rule assumes your test folder structure matches your lib folder structure.
note
This rule requires configuration in order to highlight any issues.
warning
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 the rule will apply to.
analysis_options.yaml
dcm:
rules:
- avoid-missing-test-files:
patterns:
- all/my/*.models.dart
- some/other/file.dart
warning
For Windows devices, ensure that the patterns config works with Windows path separators.
Example
❌ Bad:
// package/lib/src/my_file.dart
// no test file // LINT: This file does not have a corresponding test file, but is expected to have one. Try adding a test file.
✅ Good:
// package/lib/src/my_file.dart
// package/test/src/my_file_test.dart