pull_request_coverage 2.1.0 pull_request_coverage: ^2.1.0 copied to clipboard
This tool is designed to analyze the test coverage rate of a pull request, taking into consideration only the lines that have been changed.
Check the readme file to learn how to personalize the output. There are options such as disabling emojis, colors, etc.
CLI output #
flutter test --coverage
git diff origin/main | pull_request_coverage --maximum-uncovered-lines 5 --minimum-coverage 99
Output example
Markdown output #
flutter test --coverage
git diff origin/main | pull_request_coverage --maximum-uncovered-lines 5 --minimum-coverage 99 --output-mode markdown
Output example
cat input_samples/sample1/git.diff | dart bin/pull_request_coverage.dart --lcov-file input_samples/sample1/lcov.info --maximum-uncovered-lines 5 --minimum-coverage 99 --output-mode markdown
lib/src/presentation/output_print_generator/cli_output_generator.dart
(+16) 🎉
lib/src/presentation/output_print_generator/markdown_output_generator.dart
(+14) 🎉
lib/src/presentation/output_print_generator/output_generator.dart
(+1) 🎉
🚨 lib/src/presentation/output_print_generator/cli_table_builder.dart
(+59)
- 6 lines missing tests
25: String build() {
26: final stringBuffer = StringBuffer();
27: final columnSize = List.generate(columnsLength, (index) => 0);
- 28: for (var columnIndex = 0; columnIndex < columnsLength; columnIndex++) {
- 29: for (var lineIndex = 0; lineIndex < table.length; lineIndex++) {
- 30: if (table[lineIndex][columnIndex].length > columnSize[columnIndex]) {
- 31: columnSize[columnIndex] = table[lineIndex][columnIndex].length;
32: }
33: }
34: }
43: }
44: stringBuffer.writeln();
45: for (var i = 0; i < header.length; i++) {
- 46: stringBuffer.write(_createContent("", columnSize[i], "-"));
- 47: stringBuffer.write(columnDivider);
48: }
49: }
50: for (var lineIndex = 0; lineIndex < table.length; lineIndex++) {
Report | Current value | Threshold | |
---|---|---|---|
Lines that should be tested | 89 | ||
Ignored untested lines | 0 | ||
Lines missing tests | 6 | 5 | ❌ |
Coverage rate | 93.26% | 99.0% | ❌ |
Markdown output using dart
mode #
flutter test --coverage
git diff origin/main | pull_request_coverage --maximum-uncovered-lines 5 --minimum-coverage 99 --output-mode markdown --markdown-mode dart
Output example
cat input_samples/sample1/git.diff | dart bin/pull_request_coverage.dart --lcov-file input_samples/sample1/lcov.info --maximum-uncovered-lines 5 --minimum-coverage 99 --output-mode markdown --markdown-mode dart
lib/src/presentation/output_print_generator/cli_output_generator.dart
(+16) 🎉
lib/src/presentation/output_print_generator/markdown_output_generator.dart
(+14) 🎉
lib/src/presentation/output_print_generator/output_generator.dart
(+1) 🎉
🚨 lib/src/presentation/output_print_generator/cli_table_builder.dart
(+59)
- 6 lines missing tests
String build() {
final stringBuffer = StringBuffer();
final columnSize = List.generate(columnsLength, (index) => 0);
for (var columnIndex = 0; columnIndex < columnsLength; columnIndex++) { // <- MISSING TEST AT LINE 28
for (var lineIndex = 0; lineIndex < table.length; lineIndex++) { // <- MISSING TEST AT LINE 29
if (table[lineIndex][columnIndex].length > columnSize[columnIndex]) { // <- MISSING TEST AT LINE 30
columnSize[columnIndex] = table[lineIndex][columnIndex].length; // <- MISSING TEST AT LINE 31
}
}
}
}
stringBuffer.writeln();
for (var i = 0; i < header.length; i++) {
stringBuffer.write(_createContent("", columnSize[i], "-")); // <- MISSING TEST AT LINE 46
stringBuffer.write(columnDivider); // <- MISSING TEST AT LINE 47
}
}
for (var lineIndex = 0; lineIndex < table.length; lineIndex++) {
Report | Current value | Threshold | |
---|---|---|---|
Lines that should be tested | 89 | ||
Ignored untested lines | 0 | ||
Lines missing tests | 6 | 5 | ❌ |
Coverage rate | 93.26% | 99.0% | ❌ |