Skip to content

coverage 1.16.0: format_coverage fails on the {} that dart test --coverage writes for fully skipped suites #2667

Closed

Description

@eseidel

When every test in a suite is skipped (for example, excluded by tag in dart_test.yaml), dart test --coverage=coverage writes coverage/<path>.vm.json containing {}. Since 1.16.0, HitMap.parseFiles throws on that file, so format_coverage --in=coverage fails after a passing test run:

FormatException: Unrecognized coverage JSON in "coverage/test/ensure_build_test.dart.vm.json". Expected a {"coverage": [...]} report, but got _Map<String, dynamic>.
#0      HitMap.parseFiles (package:coverage/src/hitmap.dart:190:11)
#1      main (.../coverage-1.16.0/bin/format_coverage.dart:74:18)

Repro:

  1. A package with one test file tagged @Tags(['skipme']) and tags: {skipme: {skip: true}} in dart_test.yaml.
  2. dart test --coverage=coverage
  3. dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info

This works with 1.15.1. Either format_coverage could treat {} as an empty report, or dart test could skip writing the file for suites that collected nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions