You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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. 🙏
Reacted by Felix Angelov, Felipe Morschel, Danny Tuppeny, Chris Thompson and Stefan Matthias Aust
Reacted by Felipe Morschel, Felix Angelov, Danny Tuppeny and Chris Thompson
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.
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.
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.
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.
Activity
eseidel commentedon Aug 1, 2025
I use this in my scripts to get a lcov file (yes, it's unfortunate that dart coverage and flutter coverage are different):
I'm super excited for this feature to exist for Dart tests, not just Flutter tests. 🙏
sma commentedon Aug 25, 2025
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.
FMorschel commentedon Aug 25, 2025
@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.
WIP
DanTup commentedon Oct 8, 2025
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:testrelease before it can be used, since it's the version oftestused by your project that matters and not the one in the SDK.Once there's a new
pkg:testrelease, I'll finish off the work for this and test it.Add support for Coverage in Dart projects
Add support for Coverage in Dart projects
Add support for Coverage in Dart projects
DanTup commentedon Nov 13, 2025
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
dartversion of this (--coverage-package). I've opened #5798 to track that.