chore(web): Add option to create test coverage report file#10124
chore(web): Add option to create test coverage report file#10124ermshiperete merged 2 commits intomasterfrom
Conversation
This adds a `coverage` parameter to `web/build.sh` that will create a coverage report in HTML format in `web/build/coverage/index.html`.
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
There was a problem hiding this comment.
It's worth noting that use of c8 for coverage will, at present, only report coverage for parts that are testable headlessly - I don't think c8 will "kick in" during karma-based unit (web/src/test/auto/dom) or integrated (web/src/test/auto/integrated) tests. If you want to double-check that, post a copy or a screenshot of the reports you're currently getting as output; I should be able to tell pretty quickly.
If my intuition here is correct, the coverage reports may feel a bit 'lacking' in that regard - lots of KeymanWeb's code at this level is DOM-dependent. I did look around a bit for anything simple that might be viable, but the simplest thing I've found is this: https://webreflection.medium.com/js-on-dom-code-coverage-bb1f9011780f
There's a fair bit of work involved, and the direction I got at the time was that doing code-coverage for KeymanWeb was too low a priority. Granted, that was before the gesture work and ES module work was completed, so maybe it's different now.
| "configure" \ | ||
| "build" \ | ||
| "test" \ | ||
| "coverage Create an HTML page with code coverage" \ |
There was a problem hiding this comment.
I just noticed - this is only in build.sh, with no equivalent in test.sh?
There was a problem hiding this comment.
yes, I thought it's sufficient to have it in the top-level build.sh
|
OK, so running it locally, I get... Looks like it just collates the different coverage reports across all subcomponents (filtered based on Web's The lack of anything regarding DOM-based components isn't completely ideal... but is probably better than falsely claiming 0% coverage for them. Gesture stuff shows up in the report since I didn't do a repo-wide clean; its coverage stuff was still lingering around and possible for the coverage collator to pick up. |
Co-authored-by: Marc Durdin <marc@durdin.net>
|
I agree - it's not ideal that we don't show coverage for all code, but it's a start that we can improve over time. |
|
Changes in this pull request will be available for download in Keyman version 17.0.223-alpha |

This adds a
coverageparameter toweb/build.shthat will create a coverage report in HTML format inweb/build/coverage/index.html.@keymanapp-test-bot skip