getLibPath method

String getLibPath(
  1. String testPath
)

Maps a test file back to its corresponding source file.

Implementation

String getLibPath(String testPath) {
  final relativePath =
      p.relative(testPath, from: p.join(projectRoot, 'test'));
  final fileName =
      p.basenameWithoutExtension(relativePath).replaceAll('_test', '');
  final directory = p.dirname(relativePath);

  return p.join(projectRoot, 'lib', directory, '$fileName.dart');
}