code_coverage 1.0.0-SNAPSHOT.1 copy "code_coverage: ^1.0.0-SNAPSHOT.1" to clipboard
code_coverage: ^1.0.0-SNAPSHOT.1 copied to clipboard

outdated

A CLI tool and package useful for reporting code coverage of a given dart package

Code Coverage #

A command-line application and package for Code Coverage Reporting of a Dart application.

CLI #

Installation #

To use the CLI you first need to install it globally using pub global activate code_coverage or dart pub gobal activate code_coverage.

Usage #

After installation, you can simply run code_coverage on the base directory of your package.
Alternatively you can run it using pub global run code_coverage or even dart pub global run code_coverage, again, on the base directory of your package.

The output will be something like this:

Running package tests...
┌────────────────────┬────────────┬───────────────────┐
│ File               │ Coverage % │ Uncovered Lines   │
├────────────────────┼────────────┼───────────────────┤
│ All covered files  │      45.83 │                   │
│ src/utils.dart     │      52.38 │ 38-42, 44, 48-51  │
│ src/constants.dart │       0.00 │ 3-5               │
└────────────────────┴────────────┴───────────────────┘
18.18% (2/11) of all files were covered

As you can see, the CLI will run your package tests and output a table showing which files and how much of them were reached.

Options

Even though the base command you do for some people, there are some options to provide flexibility for the user, they are:

  • --showOutput, -o: This option will show the dart test output, so the total output will be something like this:
Running package tests...
00:00 +0: test\utils_test.dart: should concatenate small group of lines as a range
00:00 +1: test\utils_test.dart: should concatenate medium group of lines as a range
00:00 +2: test\utils_test.dart: should concatenate two lines as separate
00:00 +3: test\utils_test.dart: should concatenate lines as range and separate
00:00 +4: test\utils_test.dart: should concatenate lines with a range followed by another range
00:00 +5: test\utils_test.dart: should concatenate lines as two ranges and two separate
00:03 +6: All tests passed!
┌────────────────────┬────────────┬───────────────────┐
│ File               │ Coverage % │ Uncovered Lines   │
├────────────────────┼────────────┼───────────────────┤
│ All covered files  │      45.83 │                   │
│ src/utils.dart     │      52.38 │ 38-42, 44, 48-51  │
│ src/constants.dart │       0.00 │ 3-5               │
└────────────────────┴────────────┴───────────────────┘
18.18% (2/11) of all files were covered
  • --packageDir, -d: With this option you can specify the directory of the package that will be tested.
6
likes
0
points
120
downloads

Publisher

verified publishergustavohill.dev

Weekly Downloads

A CLI tool and package useful for reporting code coverage of a given dart package

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ansicolor, args, coverage, path, yaml

More

Packages that depend on code_coverage