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

Unhandled exception when trying to convert lcov.info to coverage.lcov #481

Closed Wizzel1 closed 2 years ago

Wizzel1 commented 2 years ago

After I run

flutter test --coverage there is a coverage folder with an lcov.info in my project, so this part works.

When I try to convert it with pub run coverage:format_coverage --lcov --in=coverage/lcov.info --out=coverage.lcov --packages=.packages --report-on=lib

I get an error:

Unhandled exception:
SF:lib\core\exceptions\auth_exceptions\reset_password_exceptions\reset_pass...
^

#0      _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1405:5)
dart-lang/coverage#1      _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1272:9)
dart-lang/coverage#2      _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:937:22)
dart-lang/coverage#3      _parseJson (dart:convert-patch/convert_patch.dart:40:10)
dart-lang/coverage#4      JsonDecoder.convert (dart:convert/json.dart:506:36)
dart-lang/coverage#5      JsonCodec.decode (dart:convert/json.dart:157:41)
dart-lang/coverage#6      parseCoverage (package:coverage/src/hitmap.dart:143:26)
dart-lang/coverage#7      main (file:///C:/Users/Wizzel/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/coverage-1.0.3/bin/format_coverage.dart:59:24)
dart-lang/coverage#8      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
dart-lang/coverage#9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
pub finished with exit code 255

I have also tried this: pub run coverage:format_coverage --lcov --in=coverage --out=coverage.lcov --packages=.packages --report-on=lib but that returns an empty coverage.lcov file.

What am I missing?

liamappelbe commented 2 years ago

format_coverage converts a coverage.json file into an lcov file (or pretty prints it). From that error, it looks like your input file is already an lcov file. So you don't need to run format_coverage at all. You probably just need to move/rename coverage/lcov.info to coverage.lcov.