dart-lang / tools

This repository is home to tooling related Dart packages.
BSD 3-Clause "New" or "Revised" License
32 stars 26 forks source link

error generating .lcov "This file is deprecated. Tools should instead consume" #503

Closed iapicca closed 2 years ago

iapicca commented 2 years ago

it's more than possible that this is my fault and not package's fault, it's also that I have missed some breaking change, but before it worked just fine

I'm having trouble generating coverage.lcov running github action in a monorepo (using melos)

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
dart-lang/coverage#1      parsePackageConfigString (package:package_config/src/package_config_json.dart:54:12)
267
dart-lang/coverage#2      PackageConfig.parseString (package:package_config/src/package_config.dart:94:7)
268
dart-lang/coverage#3      Resolver._parsePackages (package:coverage/src/resolver.dart:115:23)
269
dart-lang/coverage#4      Resolver.create (package:coverage/src/resolver.dart:34:13)
270
dart-lang/coverage#5      HitMap.parseJson (package:coverage/src/hitmap.dart:191:46)
271
dart-lang/coverage#6      HitMap.parseFiles (package:coverage/src/hitmap.dart:212:41)
272
dart-lang/coverage#7      main (file:///home/runner/.pub-cache/hosted/pub.dartlang.org/coverage-1.5.0/bin/format_coverage.dart:66:31)
273
dart-lang/coverage#8      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
274
dart-lang/coverage#9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
279
--------------------------------------------------------------------------------

is that the correct command to generate coverage.lcov?

stackoverflow mirror

here is the whole log

liamappelbe commented 2 years ago

Seems like you solved it yourself on the stack overflow thread. But just to add another solution option, you can also use this command to gather and format coverage in one step:

dart pub global run coverage:test_with_coverage