Support passing extra arguments to test_with_coverage
which are then passed to package:test
.
Example: dart run coverage:test_with_coverage -- --preset CI
HitMap.parseJsonSync
which takes a cache of ignored lines which can speedup calls when checkIgnoredLines
is true and the function is called several times with overlapping files in the input json.--reportOn
on windows using incorrect path separators.dart pub global run coverage:test_with_coverage
or dart run coverage:test_with_coverage
--package
flag, which takes the package's root directory, instead of the .package file. Deprecate the --packages
flag.HitMap.parseJson
, HitMap.parseFiles
, createHitmap
, and parseCoverage
.test_with_coverage
. This simplifies the most common use case of coverage, running all the tests for a package, and generating an lcov.info file.libraryFilters
option in getSourceReport
to speed up coverage runs that use scopedOutput
.--branch-coverage
(abbr -b
) to collect_coverage that collects branch coverage information. The VM must also be run with the --branch-coverage
flag.--pretty-print-branch
to format_coverage that works similarly to pretty print, but outputs branch level coverage, rather than line level.--lcov
(abbr -l
) in format_coverage to output branch level coverage, in addition to line level.collect
that controls whether branch coverage is collected.branchHits
field to HitMap
.--function-coverage
(abbr -f
) to collect_coverage that collects function coverage information.--pretty-print-func
(abbr -f
) to format_coverage that works similarly to pretty print, but outputs function level coverage, rather than line level.--lcov
(abbr -l
) in format_coverage to output function level coverage, in addition to line level.collect
that controls whether function coverage is collected.HitMap.parseJson
, FileHitMaps.merge
, HitMap.parseFiles
, HitMap.toJson
, FileHitMapsFormatter.formatLcov
, and FileHitMapsFormatter.prettyPrint
that switch from using Map<int, int>
to represent line coverage to using HitMap
(which contains both line and function coverage). Document the old versions of these functions as deprecated. We will delete the old functions when we update to coverage version 2.0.0.createHitmap
returns a sorted hitmap. This fixes a potential issue with ignore line annotations.reportLines
flag in vm_service
's getSourceReport
RPC. This typically halves the number of RPCs that the coverage collector needs to run.>=2.14.0
vm_service
package from >=6.1.0 <8.0.0
to >=8.1.0 <9.0.0
.vm_service
package from ^6.1.0
to >=6.1.0 <8.0.0
.--packages
argument wasn't passed to format_coverage
.sourceUriProvider
to return null
.1.x.x
.args
, logging
, and package_config
deps to allow the latest stable releases.vm_service
package from >=1.0.0 < 5.0.0
to >=1.0.0 <7.0.0
.--package-root
option from bin/run_and_collect.dart
and bin/format_coverage.dart
as well as from runAndCollect
and the Resolver
constructor.--wait-paused
with collect
would attempt to collect coverage if no isolates have started.vm_service
package from >=1.0.0 < 5.0.0
to >=1.0.0 <6.0.0
.Add flag --check-ignore
that is used to ignore lines from coverage depending on the comments.
Use // coverage:ignore-line to ignore one line. Use // coverage:ignore-start and // coverage:ignore-end to ignore range of lines inclusive. Use // coverage:ignore-file to ignore the whole file.
Add flag --check-ignore
that is used to ignore lines from coverage depending on the comments.
Use // coverage:ignore-line to ignore one line. Use // coverage:ignore-start and // coverage:ignore-end to ignore range of lines inclusive. Use // coverage:ignore-file to ignore the whole file.
vm_service
package from >=1.0.0 <4.0.0
to >=1.0.0 <5.0.0
.1.9.0
which supports package_config.json files and should be forwards compatible with 2.0.0
.packageRoot
argument on Resolver
.vm_service
package from >=1.0.0 <3.0.0
to >=1.0.0 <4.0.0
..json
files for the format_coverage
command.parseChromeCoverage
to merge coverage information for a given line.parseChromeCoverage
. Coverage will not be considered for Dart files that have corresponding invalid source maps.parseChromeCoverage
for creating a Dart based coverage report from a Chrome coverage report.vm_service
package from >=1.0.0 < 2.1.2
to >=1.0.0 <3.0.0
now that breakage introduced in version 2.1.2
has been resolved. Fixed in: https://github.com/dart-lang/sdk/commit/7a911ce3f1e945f2cbd1967c6109127e3acbab5a.vm_service
package from >=1.0.0 <3.0.0
down to >=1.0.0 <2.1.2
in order to exclude version 2.1.2
which is broken on the current stable Dart VM due to a missing SDK constraint in its pubspec.yaml. The breakage was introduced in: https://github.com/dart-lang/sdk/commit/9e636b5ab4de850fb19bc262e0686fdf14bfbfc0.vm_service
package from ^1.0.0
to >=1.0.0 <3.0.0
. Ensures dependency version range compatibility with the latest versions of package test
.collect
to filter coverage results by a set of VM isolate IDs.package:vm_service_lib
, which is no longer maintained, to package:vm_service
, which is.--scope-output
which restricts coverage output so that only scripts that start with the provided path are considered.dart:
libraries by default, which provides a significant performance boost. To restore the previous behaviour and collect coverage for these libraries, use the --include-dart
flag.package:vm_service_client
, which is no longer maintained, to package:vm_service_lib
, which is.collect()
now immediately throws ArgumentError
if a null URI is passed in the serviceUri
parameter to avoid a less-easily debuggable null dereference later. See dart-lang/coverage#240 for details.createHitmap
and mergeHitmaps
now specify generic types (Map<String, Map<int, int>>
) on their hit map parameter/return value.>=1.21.0
. Required for method generics.--host
and --port
options to collect_coverage
. This is a temporary measure for backwards-compatibility that may stop working on Dart SDKs >= 1.22. See the related breaking change note for the Dart VM service protocol.collect
no longer supports the host
and port
parameters. These are replaced with a serviceUri
parameter. As of Dart SDK 1.22, the Dart VM will emit Observatory URIs that include an authentication token for security reasons. Automated tools will need to scrape stdout for this URI and pass it to collect_coverage
.collect_coverage
: the --host
and --port
options have been replaced with a --uri
option. See the above change for details.runAndCollect
now defaults to running in checked mode.extractObservatoryUri
: scrapes an input string for an Observatory URI. Potentially useful for automated tooling after Dart SDK 1.22.checked
parameter to runAndCollect
to run in checked mode.Formatter.format
parameters reportOn
and basePath
to constructor. Eliminated pathFilter
parameter.format_coverage
: add --base-directory
option. Source paths in LCOV/pretty-print output are relative to this directory, or absolute if unspecified.format_coverage
: support --packages
option for package specs.packages
path component.format_coverage
.collect_coverage
: prevent hang if initial VM service connection is slow.evaluate:source
ranges may appear in the returned source report manifesting in a crash in collect_coverage
. These generally correspond to source evaluations in the debugger and add little value to line coverage.format_coverage
: may be slower for large sets of coverage JSON input files. Unlikely to be an issue due to elimination of --coverage-dir
VM flag.Require at least Dart SDK 1.16.0.
Bugfix in format_coverage: if --report-on
is not specified, emit all coverage, rather than none.
Formatter.format
added two optional arguments: reportOn
and pathFilter
. They can be used independently to limit the files which are included in the output.
Added runAndCollect
API to library.
Added collect
top-level method.
Updated support for latest 0.11.0
dev build.
Replaced ServiceEvent.eventType
with ServiceEvent.kind
.
ServiceEvent.eventType
is deprecated and will be removed in 0.8
.format_coverage
no longer emits SDK coverage unless --sdk-root is set explicitly.
Removed support for collecting coverage from old (<1.9.0) Dart SDKs.
Removed deprecated Resolver.pkgRoot
.
Optimized formatters and fixed return value of format
methods.
Added Resolver.packageRoot
– deprecated Resolver.pkgRoot
.
Support the latest release of args
package.
Support the latest release of logging
package.
Fixed error when trying to access invalid paths.
Require at least Dart SDK v1.9.0.
pub global run
.