I'm having trouble generating coverage.lcov
running github action
in a monorepo (using melos)
I think the problem may be caused by coverage, but it's also possible
that I have missed some breaking change (the past year I was busy)
this is the relevant part of melos.yaml
test:format:
run: melos exec -c 1 -- format_coverage --lcov --check-ignore --in=coverage --out=coverage.lcov --packages=.packages --report-on=lib
description: Format Dart tests' coverage data
select-package:
flutter: false
dir-exists: test
and this is the coverage
command that fails
format_coverage --lcov --check-ignore --in=coverage --out=coverage.lcov --packages=.packages --report-on=lib
with these logs
261
Unhandled exception:
262
FormatException: Unexpected character (at character 1)
263
# This file is deprecated. Tools should instead consume
264
^
265
#0 throwError (package:package_config/src/errors.dart:32:35)
266
#1 parsePackageConfigString (package:package_config/src/package_config_json.dart:54:12)
267
#2 PackageConfig.parseString (package:package_config/src/package_config.dart:94:7)
268
#3 Resolver._parsePackages (package:coverage/src/resolver.dart:115:23)
269
#4 Resolver.create (package:coverage/src/resolver.dart:34:13)
270
#5 HitMap.parseJson (package:coverage/src/hitmap.dart:191:46)
271
#6 HitMap.parseFiles (package:coverage/src/hitmap.dart:212:41)
272
#7 main (file:///home/runner/.pub-cache/hosted/pub.dartlang.org/coverage-1.5.0/bin/format_coverage.dart:66:31)
273
#8 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
274
#9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
279
--------------------------------------------------------------------------------
what is the correct command to generate coverage.lcov
?
here are the logs
it turned out the commands
dart test --coverage="coverage"
and
flutter test --coverage
already output a lcov.info
file
(I'm quite sure that wasn't always the case)
so no need to run format_coverage
at all
(and codecov/codecov-action@v3
picks that up nicely)