Skip to content
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

experimentation with code coverage through jest #373

Merged
merged 2 commits into from
Jul 24, 2024
Merged

Conversation

jduss4
Copy link
Contributor

@jduss4 jduss4 commented Jul 22, 2024

Changes proposed in this pull request:

I enabled code coverage reports via jest to see how it works and what our current coverage levels are. I did not enable a failure threshold, but jest allows us to configure different thresholds for the entire app vs functions vs groups of lines, which we could use with our CI to auto-fail anything not passing those thresholds without adding any additional steps to the CI itself. See https://jestjs.io/docs/configuration#coveragethreshold-object

These are the types of results I am currently getting with the default reporter:

[alt: code coverage report with low 60% for all files, decent coverage for the api directory, and then very little to no test coverage for the apps/orgs directory. A list of uncovered line numbers accompanies the results.]

image

I have the following questions:

  1. Do we want to experiment with any other tools or just roll ahead with jest?
  2. What files do we want to exclude from test coverage? Any additional from what I already excluded?
  3. What thresholds do we want to set?

Run code coverage

Just run npm run test like normal (you will need the docker db and uaa running) and at the end you will get a report in your console.

Related issues

part of #126 (not completed because we're lacking thresholds and also we need to beef up tests to meet thresholds, likely)

Submitter checklist

  • Added logging is not capturing sensitive data and is set to an appropriate level (DEBUG vs INFO etc)
  • Updated relevant documentation (README, ADRs, explainers, diagrams)

Security considerations

None that I am aware of

@jduss4
Copy link
Contributor Author

jduss4 commented Jul 24, 2024

I set thresholds that are higher than our current rates to make sure that they would fail the github action, and it's working. After chatting, @echappen and I are going to set the limits to just under what our tests are currently coming in at as a starting point.

image

@jduss4 jduss4 force-pushed the 126/code-coverage branch from ee1fc84 to ef67537 Compare July 24, 2024 14:48
@jduss4 jduss4 marked this pull request as ready for review July 24, 2024 14:48
@jduss4 jduss4 requested a review from a team as a code owner July 24, 2024 14:48
@drewbo
Copy link

drewbo commented Jul 24, 2024

@jduss4 FWIW, Pages is probably moving our testing to Jest also (at some unspecified date): cloud-gov/pages-core#4014 (comment)

Copy link
Contributor

@echappen echappen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🎉

@jduss4 jduss4 merged commit 77b2fa4 into main Jul 24, 2024
4 checks passed
@jduss4 jduss4 deleted the 126/code-coverage branch July 24, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants