Skip to content

Code Coverage Visualization for Dart #5575

Closed

Description

@DanTup

Splitting this from #2860 because currently flutter --coverage captures lcov files but dart test --coverage does not. This may change with dart-lang/test#2511 so I'm implementing lcov/Flutter first and then we can easily enable Dart later.

Activity

  1. added this to the On Deck milestone on Jul 3, 2025
  2. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    in testingRelates to test execution of Dart/Flutter tests for end users
    on Jul 3, 2025
  3. eseidel commented on Aug 1, 2025

    @eseidel

    I use this in my scripts to get a lcov file (yes, it's unfortunate that dart coverage and flutter coverage are different):

    dart pub get
    dart test --coverage=coverage
    dart pub global run coverage:format_coverage --lcov --in=coverage \
        --out=coverage/lcov.info --packages=.dart_tool/package_config.json \
        --report-on=lib \
        --check-ignore
    

    I'm super excited for this feature to exist for Dart tests, not just Flutter tests. 🙏

  4. sma commented on Aug 25, 2025

    @sma

    Some time ago, I wrote an article on Reddit how to convert Dart's own format into lcov.info files which isn't that difficult. Perhaps that's helpful for this issue. The code is available here.

  5. FMorschel commented on Aug 25, 2025

    @FMorschel
    Contributor

    @sma, thanks!

    But in this case, we are working with the Dart test team, and the already mentioned issue above on Dart test (dart-lang/test#2511) makes this change internally. After that, making things work here on the extension is simpler, and it makes any other IDE that wants to have this functionality be able to rely on the base language tooling too.

  6. added a commit that references this issue on Sep 15, 2025
  7. added
    in coverageRelates to collecting code coverage when running Dart/Flutter tests
    on Sep 24, 2025
  8. DanTup commented on Oct 8, 2025

    @DanTup
    MemberAuthor

    A note for myself so I don't keep looking this up whenever I come back to this... Some of the Dart changes for this landed, but we need a new pkg:test release before it can be used, since it's the version of test used by your project that matters and not the one in the SDK.

    Once there's a new pkg:test release, I'll finish off the work for this and test it.

  9. modified the milestones: On Deck, v3.124.0 on Nov 13, 2025
  10. DanTup commented on Nov 13, 2025

    @DanTup
    MemberAuthor

    This is now implemented (though your package needs to be using pkg:test ?= v1.27.0 which was released a few days ago).

    It does not yet support capturing coverage for other packages in your workspace, it only captures for the package containing the tests - that's because there's still one flag missing from the dart version of this (--coverage-package). I've opened #5798 to track that.

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

    in coverageRelates to collecting code coverage when running Dart/Flutter testsin testingRelates to test execution of Dart/Flutter tests for end usersis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions