https://github.com/bitsydarel/db_test_coverage
https://github.com/bitsydarel/db_test_coverage
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bitsydarel/db_test_coverage
- Owner: bitsydarel
- Created: 2021-07-20T20:53:17.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-27T16:51:34.000Z (almost 5 years ago)
- Last Synced: 2025-10-23T03:18:07.498Z (8 months ago)
- Language: Dart
- Size: 85 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# db_test_coverage
test coverage tool for dart, flutter.
## Overview
A command-line tool that run tests with coverage on a project.
It’s help you automate verification that your project code coverage meet your expected standard.
[license](https://github.com/bitsydarel/db_test_coverage/blob/master/LICENSE).
## Installation
db_test_coverage is dependent on lcov being installed.
So first install lcov.
### MacOS
```shell
brew install lcov
```
### Linux
```shell
apt install lcov
```
After, installing lcov you can run.
```bash
pub global activate db_test_coverage
```
## Usage
```shell
test_coverage --package-name example
```
```shell
Options:
--project-type Specify the type of project the script is run on
[flutter] (default) Test coverage for flutter project
--package-name (mandatory) Specify the package name of this project
--src-dir Specify the src directory of this project
(defaults to "lib/src")
--test-dir Specify the test directory of this project
(defaults to "test")
--coverage-dir-path Specify the test coverage directory of this project
(defaults to ".test_coverage")
--coverage-exclude= Specify the file pattern from the coverage report
--min-cov Specify the minimum coverage percentage of code coverage allowed, from 0.0 to 1.0
(defaults to "0.0")
--[no-]help Print help message
```
### Run db_test_coverage and check if code coverage is at least 70%
```shell
test_coverage --package-name example --min-cov 0.7
```
### Run db_test_coverage but removed unneeded files from the code coverage report.
```shell
test_coverage --package-name example --coverage-exclude 'lib/src/*.g.dar', 'lib/generated_plugin_registrant.dart'
```