Multiple Dart test targets are available:
fx test
.fx tests --host
.Note that in order to be built and run on bots, the test targets need to be included in the packages that are configured to run there. For example, in sdk this can be achieved by adding those tests to //sdk:tests
.
To generate an HTML coverage report from all dart_test
s, first build them with fx build
and then run:
scripts/dart/report_coverage.py --report-dir ...
This script runs all of the dart tests in your <out>/host_tests/
dir with coverage enabled. Under the hood, each test uses the coverage collection support from flutter.
The basic logic is:
for test in host_tests: covered_lines += lines in test's package that were covered by test total_lines += all lines in test's package
So if there are packages that have no tests at all, they won't be considered in the denominator of the report, which can give you a misleadingly high coverage number.