Last updated:
0 purchases
lcov excluder
lcov_excluder #
It is possible to exclude coverage by editing the contents of the lcov.info file.
Getting started #
Add lcov_excluder to your pubspec.yaml file. Or, activate lcov_excluder to your global pub.
$ dart pub global activate lcov_excluder
copied to clipboard
Requirements #
Dart 3.0.0+
Usage #
Create configuration YAML file #
Create lcov-config.yaml on your project root directory. Or, you can create a .yaml file with any name and specify the file during the execution of lcov_excluder. If no specification is provided, lcov-config.yaml will be automatically loaded.
$ dart run lcov_excluder exclude --config-file your-config.yaml
copied to clipboard
Basic configuration file example #
Define coverage at the root. coverage can have default, target and targets defined.
coverage:
default:
exclude:
- "lib/**/*.*.dart"
target:
sources:
- "cov/lcov.info"
exclude:
- "lib/db/*"
- "lib/test/*"
targets:
- service:
sourceRoot: packages/service
exclude:
- "lib/service/*"
- db:
sources:
- "packages/db/coverage/lcov.info"
- "packages/db/cov/lcov.info"
copied to clipboard
Sources #
You can define sourceRoot and sources for each target. sourceRoot specifies the source root, and sources specifies the paths to the lcov.info files. sourceRoot can also be omitted. The following two definitions have the same meaning:
coverage:
target:
sourceRoot: packages/root
sources:
- "lib/cov/lcov.info"
- "bin/cov/lcov.info"
exclude:
- "lib/**/*.*.dart"
copied to clipboard
and
coverage:
target:
sources:
- "packages/root/lib/cov/lcov.info"
- "packages/root/bin/cov/lcov.info"
exclude:
- "lib/**/*.*.dart"
copied to clipboard
It is also possible to omit sources. In that case, the lcov.info specified during the execution of lcov_excluder will be loaded.
$ dart run lcov_excluder exclude --info-file your-lcov.info
copied to clipboard
If sources is omitted and no info-file is specified, coverage/lcov.info will be automatically loaded.
Exclude #
The exclude keyword specifies the files to be excluded. You can use globs to specify the exclude pattern. Files that match the globs specified in exclude will be excluded.
coverage:
target:
exclude:
- "lib/**/*.*.dart"
copied to clipboard
When configured as shown above, all Dart files with double extensions under the lib directory will be excluded.
The exclude defined in default is merged into all target configurations and takes precedence over the exclude in target. In the following configuration, lib/**/*.*.dart is excluded not only from the target, but also from the lcov.info files of test1 and test2.
coverage:
default:
exclude:
- "lib/**/*.*.dart"
target:
exclude:
- "lib/sample/*"
targets:
- test1:
sources:
- "packages/test1/coverage/lcov.info"
exclude:
- "lib/service/*"
- test2:
sources:
- "packages/test2/coverage/lcov.info"
copied to clipboard
Target #
The target keyword can also be omitted. The following two definitions have the same meaning.
coverage:
target:
sources:
- "cov/lcov.info"
exclude:
- "lib/**/*.*.dart"
copied to clipboard
and
coverage:
sources:
- "cov/lcov.info"
exclude:
- "lib/**/*.*.dart"
copied to clipboard
targets allows you to define multiple targets. Each item in targets should have the same definition as target. Additionally, you can specify any string as the key for each item in targets.
coverage:
targets:
- example:
sources:
- "cov/lcov.info"
exclude:
- "lib/**/*.*.dart"
copied to clipboard
License #
Smooth Counter is released under the BSD-3-Clause License.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.