coverage_lens 1.2.1 copy "coverage_lens: ^1.2.1" to clipboard
coverage_lens: ^1.2.1 copied to clipboard

Static HTML coverage reports for Dart and Flutter LCOV output with compact source previews and threshold checks.

example/main.dart

import 'dart:io';

import 'package:coverage_lens/coverage_lens.dart';

void main() {
  const lcov = '''
SF:lib/calculator.dart
DA:1,1
DA:2,0
BRDA:2,0,0,1
BRDA:2,0,1,0
LF:2
LH:1
BRF:2
BRH:1
end_of_record
''';

  final parsed = LcovParser().parse(lcov);
  final records = LcovRecordMerger().merge(parsed.files);
  final report = CoverageAnalyzer().analyze(
    records: records,
    sourceResolver: const InMemorySourceResolver({
      'lib/calculator.dart': '''
int add(int a, int b) => a + b;
int sign(int value) => value >= 0 ? 1 : -1;
''',
    }),
    config: const CoverageAnalysisConfig(
      lineWarningThreshold: 90,
      branchWarningThreshold: 80,
    ),
  );

  stdout.writeln(
    'Line coverage: '
    '${report.summary.lineCoveragePercent.toStringAsFixed(1)}%',
  );
  stdout.writeln(
    'Branch coverage: '
    '${report.summary.branchCoveragePercent?.toStringAsFixed(1)}%',
  );
  stdout
      .writeln('Files below threshold: ${report.summary.filesBelowThreshold}');
}
0
likes
0
points
64
downloads

Publisher

unverified uploader

Weekly Downloads

Static HTML coverage reports for Dart and Flutter LCOV output with compact source previews and threshold checks.

Repository (GitHub)
View/report issues

Topics

#coverage #lcov #testing #cli #flutter

License

unknown (license)

Dependencies

args, image, path, yaml

More

Packages that depend on coverage_lens