Commit 2680b74
committed
feat: add --collect-coverage-from option to include untested files in coverage
Closes #418
Adds a new --collect-coverage-from option to the very_good test command that
allows users to choose between:
- imports (default): collect coverage from imported files only (current behavior)
- all: collect coverage from all Dart files in the project, showing 0% for untested files
This enables stricter coverage requirements that account for all project files,
not just those exercised by tests. Works with both Flutter and Dart projects.
Implementation details:
- Added CoverageCollectionMode enum with imports/all modes
- Implemented _discoverDartFilesForCoverage() to find all .dart files
- Implemented _enhanceLcovWithUntestedFiles() to add untested files to LCOV
- Updated command-line parsing in test.dart and dart_test_command.dart
- Threaded the option through the entire call chain
- Respects existing --exclude-coverage and --report-on options
Usage examples:
very_good test --coverage
very_good test --coverage --collect-coverage-from all
very_good test --min-coverage 100 --collect-coverage-from all
very_good test --coverage --collect-coverage-from all --exclude-coverage '**/*.g.dart'
Files modified:
- lib/src/cli/test_cli_runner.dart: Core implementation with enum, helpers, and logic
- lib/src/commands/test/test.dart: Added option to Flutter test command
- lib/src/commands/dart/commands/dart_test_command.dart: Added option to Dart test command
- lib/src/cli/flutter_cli.dart: Thread parameter through Flutter CLI
- lib/src/cli/dart_cli.dart: Thread parameter through Dart CLI
- test/src/commands/test/test_test.dart: Updated Flutter test command tests
- test/src/commands/dart/commands/dart_test_test.dart: Updated Dart test command tests with correct help text alignment1 parent 8665469 commit 2680b74
File tree
5 files changed
+35
-28
lines changed- lib/src
- cli
- commands
- dart/commands
- test
- test/src/commands
- dart/commands
- test
5 files changed
+35
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
203 | | - | |
| 204 | + | |
| 205 | + | |
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
214 | 215 | | |
215 | 216 | | |
216 | 217 | | |
217 | | - | |
| 218 | + | |
| 219 | + | |
218 | 220 | | |
219 | 221 | | |
220 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| |||
0 commit comments