-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: expose jest coverage reports for CI runs @W-14785065 #3939
Conversation
# 1. Remove leading/trailing "border" lines from output | ||
# 2. Wrap file names in backticks | ||
# 3. Convert leading whitespace to non-breaking to approximate plaintext output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just trying to bludgeon the CLI output into a passable markdown table. Happy to consider alternative bludgeoning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an impressively gnarly sed
command, but it's not a big deal since this is only for CI. If we really wanted to improve the code for this, though, we might:
- Use the
json
reporter - Write our own
.js
script to process it and print out markdown - (Ideally) apply it to the Karma tests too, since they use Istanbul as well and I'm sure it can be configured to output JSON
That said, that might be over-engineering for this feature. It's just great to see the coverage report in the GitHub UI!
// Jest's default reporters are [clover, json, lcov, text]. We add the second text reporter to | ||
// use the output as the step summary when running tests in GitHub Actions. (Ideally, we'd use | ||
// a markdown reporter, but there don't seem to be any...) | ||
coverageReporters: ['clover', 'json', 'lcov', 'text', ['text', { file: 'coverage.txt' }]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at using the html reporter instead, but it only seems to give a high-level directory overview rather than per-file (unless you want to deeply traverse into HTML files). So yeah, text
seems most convenient here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Details
This adds the jest coverage summary to the GitHub Actions job summary and exposes the full coverage reports as artifacts.
Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
GUS work item
W-14785065