Skip to main content

match-lib-folder-structure

added in: 1.11.0
Pro+

Warns when the file path in the test folder does not match the implementation file path in the lib folder.

Keeping the same folder structure for your tests makes it easier to locate test files and allows using IDE commands such as "Go to Test/Implementation File".

note

This rule highlights test files that import implementation files with the same name (without the _test suffix).

Example

❌ Bad:

// package/lib/src/my_file.dart
// package/test/some_folder/my_file_test.dart // LINT: The location of this file in the 'test' folder does not match the location of the implementation file in the 'lib' folder.

✅ Good:

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