dart_coveralls 0.6.0+4

  • Readme
  • Changelog
  • Installing
  • 60

dart-coveralls #

Build Status Coverage Status Pub

Calculate coverage of your dart scripts, format it to LCOV and send it to coveralls.io.

NOTE: as of version 0.6.0 dart-coveralls, requires a Dart 2 SDK.

Usage #

This package consists of a single command line tool dart_coveralls with the three commands calc, report, upload.

To activate the program for global use, run pub global activate dart_coveralls.

The calc command

This command calculates the coverage of a given package. Use the tool like this:

dart_coveralls calc [--output, --package-root] test.dart
# or
dart_coveralls calc [--output, --packages] test.dart
  • --output: The output file path, if not given stdout
  • --packages: Specifies the path to the package resolution configuration file. This option cannot be used with --package-root. Defaults to ".packages".
  • --package-root: Specifies where to find imported libraries. This option cannot be used with --packages. Defaults to null.
  • test.dart: The path of the test file on which coverage will be collected

The report command

This command calculates and then sends the coverage data to coveralls.io. Usage of the tool is as follows:

dart_coveralls report <options> <test file>
  • --help – Displays all options
  • --token –Token for coveralls
  • --packages: Specifies the path to the package resolution configuration file. This option cannot be used with --package-root. Defaults to ".packages".
  • --package-root: Specifies where to find imported libraries. This option cannot be used with --packages. Defaults to null.
  • --debug Prints debug information
  • --retry Number of retries (defaults to "10")
  • --dry-run If this flag is enabled, data won't be sent to coveralls
  • -C, --throw-on-connectivity-error Should this throw an exception, if the upload to coveralls fails?
  • -E, --throw-on-error Should this throw if an error in the dart_coveralls implementation happens?
  • -T, --exclude-test-files Should test files be included in the coveralls report?
  • -p, --print-json Pretty-print the json that will be sent to coveralls.

The upload command

This command uploads a coverage report.

dart_coveralls upload <options> <directory containing coverage reports from the VM>
  • --help – Displays all options
  • --token –Token for coveralls
  • --packages: Specifies the path to the package resolution configuration file. This option cannot be used with --package-root. Defaults to ".packages".
  • --package-root: Specifies where to find imported libraries. This option cannot be used with --packages. Defaults to null.
  • --debug Prints debug information
  • --retry Number of retries (defaults to "10")
  • --dry-run If this flag is enabled, data won't be sent to coveralls
  • -C, --throw-on-connectivity-error Should this throw an exception, if the upload to coveralls fails?
  • -E, --throw-on-error Should this throw if an error in the dart_coveralls implementation happens?
  • -T, --exclude-test-files Should test files be included in the coveralls report?
  • -p, --print-json Pretty-print the json that will be sent to coveralls.

Contributing #

Help and Pull Requests are highly appreciated :)

0.6.0+4 #

  • Fixed parser to ignore lines that are not DA line coverage entries.
  • Support for --preview-dart-2 removed and SDK lower bound bumped to 2.0.0-dev.64.1.

0.6.0+3 #

  • Dart 2 fixes.

0.6.0+2 #

  • Dart SDK constraint updated to <3.0.0.
  • Package dependency updates.

0.6.0 #

  • Migrated to Dart 2.0.

0.5.0 #

  • Support the latest coverage 0.9.0 series releases.

  • Support for breaking changes introduced with Dart v1.22.0.

  • Added --packages option to all sub commands. It defaults to null, though the file path .packages will be used if no path is given in option --package-root. The --packages and --package-root options cannot be used together.

  • Refactored LcovCollector so that it doesn't duplicate logic already present in coverage.

  • Refactored CommandLineParts to minimize duplicate code.

  • Introduced a timeout of 60 seconds in cases where the VM doesn't respond. This should only be the case if the given test file contains serious syntax errors.

  • #63 --workers is ignored and will be removed in a future release.

  • #71 Submitting to coveralls now uses source_digest option instead of source. This greatly reduces coveralls report upload sizes.

0.4.0 #

  • Add an upload-only option, which does not run any script

  • Removed LcovCollector ctor testFile argument.

  • LcovCollect.getLcovInformation added testFile argument.

  • Added --log-level option to the report sub command.

0.3.0+1 #

  • Support the latest coverage 0.7.0 series releases.

0.3.0 #

  • serviceName was removed from CommandLineClient.

  • serviceName and serviceJobId are now named paramaters on CoverallsReport – constructor and parse.

  • service_name and service_job_id are correctly populated form Travis and Coveralls.

  • Can omit the token flag to report if one of REPO_TOKEN or COVERALLS_TOKEN is set as an environment variable.

  • The Coveralls job number and URL are printed after a successful report is posted to the service.

0.2.0 #

  • A number of (breaking) changes to clarify and correctly distinguish between projectDirectory – the directory containing the source project – and packageRoot – the directory containing the project packages, usually located at <projectDirectory>/packages.

  • A number of (breaking) changes to pass around paths – as String – instead of File and Directory instances.

  • CommandLinePart and subtypes execute methods are now explicitly async.

  • Added a lot more logging, especially in error cases.

  • covString and related are removed from all classes. Using standard toJson method supported by dart:convert JSON.

  • A number of public helper methods were moved to private, top-level functions.

  • Added a print-json option to report.

  • LcovCollector now puts coverage output in a temporary directory.

  • CommandLineClient and LcovCollector removed dependency on FileSystem. Constructors and fields were changed accordingly.

  • LcovCollector now parses all coverage output files. There is a lot less missed coverage, especially when isolates are being used.

  • Minimum version of coverage was bumped to 0.6.4.

0.1.12 #

  • Support latest versions of args and coverage packages.

  • Require at least Dart 1.9.0 SDK.

  • Improved the reporting of errors, especially async errors.

  • Add check of CI_BRANCH environment variable for Git branch.

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate dart_coveralls

2. Use it

The package has the following executables:


$ dart_coveralls

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dart_coveralls: ^0.6.0+4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dart_coveralls/dart_coveralls.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
46
Health:
Code health derived from static analysis. [more]
77
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
68
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Nov 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:dart_coveralls/dart_coveralls.dart with components: io.

Health suggestions

Fix lib/src/cli_client.dart. (-8.17 points)

Analysis of lib/src/cli_client.dart reported 17 hints, including:

line 33 col 35: Use = to separate a named parameter from its default value.

line 56 col 35: Use = to separate a named parameter from its default value.

line 58 col 18: Use = to separate a named parameter from its default value.

line 59 col 36: Use = to separate a named parameter from its default value.

line 60 col 16: Use = to separate a named parameter from its default value.

Fix lib/src/process_system.dart. (-5.36 points)

Analysis of lib/src/process_system.dart reported 11 hints, including:

line 13 col 36: Use = to separate a named parameter from its default value.

line 14 col 22: Use = to separate a named parameter from its default value.

line 15 col 30: Use = to separate a named parameter from its default value.

line 16 col 30: Use = to separate a named parameter from its default value.

line 29 col 36: Use = to separate a named parameter from its default value.

Fix lib/src/coveralls_entities.dart. (-4.89 points)

Analysis of lib/src/coveralls_entities.dart reported 10 hints, including:

line 19 col 29: Use = to separate a named parameter from its default value.

line 22 col 29: Use = to separate a named parameter from its default value.

line 23 col 28: Use = to separate a named parameter from its default value.

line 132 col 29: Use = to separate a named parameter from its default value.

line 141 col 29: Use = to separate a named parameter from its default value.

Fix additional 4 files with analysis or formatting issues. (-7.43 points)

Additional issues in the following files:

  • lib/src/git_data.dart (7 hints)
  • bin/src/command_line.dart (3 hints)
  • lib/src/collect_lcov.dart (3 hints)
  • bin/src/upload.dart (2 hints)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (coverage, http).

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and dart_coveralls.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is getting outdated. (-1.64 points)

The package was last published 53 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.64.1 <3.0.0
args >=0.12.1 <2.0.0 1.5.2
coverage ^0.12.0 0.12.4 0.13.3+1
crypto ^2.0.1 2.1.3
file ^5.0.0 5.1.0
http >=0.11.1+1 <0.12.0 0.11.3+17 0.12.0+2
logging >=0.9.2 <0.12.0 0.11.3+2
path ^1.3.0 1.6.4
stack_trace ^1.3.2 1.9.3
yaml ^2.1.2 2.2.0
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
http_parser 3.1.3
intl 0.16.0
json_rpc_2 2.1.0
meta 1.1.8
package_config 1.1.0
pub_semver 1.4.2
source_span 1.5.5
stream_channel 2.0.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vm_service_client 0.2.6+3
web_socket_channel 1.1.0
Dev dependencies
mockito ^3.0.0-beta+3
test ^1.0.0