discover 0.4.0
discover: ^0.4.0 copied to clipboard
Discover your real coverage with Flutter including not tested Dart files.
discover #
Get your real code coverage
Discovers helps to find all the Dart sources with no tests. Use Discover to know exactly which Dart files needs to be tested.
Generated by the Very Good CLI ๐ค
Getting Started ๐ #
Activate globally via:
dart pub global activate discover
Usage #
Perform coverage scan #
The scan sub command will search for an existing coverage tracefile and find every source file not listed.
Just run
# Scan command
$ discover scan
# Scan command option
$ discover scan --path <dart_project_path>
If no coverage file exists, Discover will automatically try to generate it using flutter test --coverage
command.
Untested files will be listed in a discover-lcov.info
file.
Finally, the HTML report will be generated using both lcov files.
Open the HTML report to Discover your real coverage.
Tooling commands #
# Show CLI version
$ discover --version
# Show usage help
$ discover --help
Ignore files #
You can ignore files by creating a .discoverignore
file in the root of your project.
|-- android
|-- ios
|-- lib
|-- linux
|-- macos
|-- test
|-- windows
|-- .discoverignore
Sample .discoverignore
file:
lib/**/*.g.dart
lib/**/*.freezed.dart
lib/view/**/*.dart
๐ Info ๐
Patterns listed in the
.discoverignore
file will be removed from the original tracefilelcov.info
Local development #
Activate locally via:
dart pub global activate --source=path <path to this package>
๐จ Note ๐จ
An issue prevents from updating the CLI using local path.
If you want to update the CLI, you need to remove
.dart_tool
directory before running the command again. See issue 4295
Running Tests with coverage ๐งช #
To run all unit tests use the following command:
$ dart pub global activate coverage 1.2.0
$ dart test --coverage=coverage
$ dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info
To view the generated coverage report you can use lcov .
# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/
# Open Coverage Report
$ open coverage/index.html