IntelliJ code coverage tools don't show coverage per-line using source maps #40031
Labels
area-intellij
Tracking issues for the Dart IntelliJ plugin.
area-web-js
Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.
I am trying to measure and improve test coverage in an Angular Dart project (the Dart CI results feed at https://dart.googlesource.com/dart_ci/+/refs/heads/master/results_feed/)
The Intellij coverage tools work adequately to run tests written using
and produce coverage reports for the Dart source files that seem correct.
The source file coverage does not show line-by-line coverage, though, which is
needed to find out where which functions aren't being covered, and add tests.
The data file stored by intellij for this dart2js coverage data is in [home]/.IntelliJIdea2019.3/system/coverage, and is a .dat file with data like:
SF:/src/dart/dart_ci/results_feed/lib/src/services/filter_service.dart DA:8,1 DA:9,1 DA:10,1 DA:12,1 DA:13,1 DA:14,0 DA:15,1 DA:17,1 DA:21,0 DA:22,0 DA:23,0 DA:24,0 DA:25,0 DA:26,0 DA:27,0
I can look at that by hand, and see what lines are covered, but the IntelliJ UI components to show it are missing when looking at this type of coverage report, which is called "WipPresentableName Coverage" in the Choose Coverage Suite IntelliJ IDEA dialog. There is no color highlighing of the lines, or option to export the data.
The tests that I run on the Dart VM, because they are unit tests with no UI, have a different type of coverage data called "Dart Coverage", which is stored as a .json file in the coverage directory
and has similar data, like
{"source":"package:intl/src/intl/date_format.dart","script":{"type":"@Script","fixedId":true,"id":"libraries/1/scripts/package%3Aintl%2Fsrc%2Fintl%2Fdate_format.dart","uri":"package:intl/src/intl/date_format.dart","_kind":"library"},"hits":[579,3,643,3,690,0,702,0,710,3,240,1,246,2,247,1,411,0,412,0,413,0,414,0,415,0,416,0,417,0,418,0,419,0,420,0,421,0,422,0,423,0,424,0,425,0,426,0,427,0,428,0,429,0,430,0,431,0,432,0,433,0,434,0,435,0,436,0,437,0,438,0,439,0,440,0,441,0,442,0,443,0,444,0,445,0,446,0,447,0 ...
do show line-by-line coverage highlighting in the IntelliJ IDEA ui.
If I run the app or tests directly in the Chrome browser, and use its devtools coverage tools, I do get line-by-line coverage highlighting in the Dart source files, though I'm not confident of its accuracy, as long as the source files can be fetched by the browser. I have a hard time running the web tests directly in the browser, though - if I load the test HTML page, it seems not to run the tests.
What is our expected workflow for looking at test code coverage in Angular apps? An issue filed against the Angular Dart repository a year ago was closed as not their job:
angulardart/angular#1654
Can we get the IDEA ui to show the line-by-line coverage? And how accurate are the source maps and their use for coverage data from browser execution? Some of the results I've seen don't really look right.
The text was updated successfully, but these errors were encountered: