isTestFile static method

bool isTestFile(
  1. String path
)

Utility to check if a file is a test file (by path).

Returns true if the file path contains '_test.dart' or is under a 'test/' directory. Normalizes path separators to work on both Windows and Unix.

Implementation

static bool isTestFile(String path) {
  final normalizedPath = path.replaceAll('\\', '/');
  return normalizedPath.contains('_test.dart') ||
      normalizedPath.contains('/test/');
}