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

Add code coverage checks and badges #99

Merged
merged 9 commits into from
May 31, 2023
Merged

Add code coverage checks and badges #99

merged 9 commits into from
May 31, 2023

Conversation

frankhinek
Copy link
Contributor

@frankhinek frankhinek commented May 29, 2023

Note: Copied over from PR #97

This PR proposes the following changes:

Tests

  • Add c8 to the six existing packages.
    • Consistent use of .c8rc.json across all packages.
  • Add Codecov to the CI GitHub Action.
    • Codecov configured to NOT block PRs if configured coverage thresholds fail to be met. We can consider enforcing this more strictly in the future once the overall lib's test coverage improves.
    • Compares the prior main branch to each PR to see if code coverage decreased by more than 5%
    • Expects new code introduced by a PR to be covered by tests.
    • Code coverage report is printed after every test run.
  • CONTRIBUTING.md updated to reflect test coverage expectations.
  • Simplifies test:node NPM script in package.json using .mocharc.json config.

Security

  • Adds a security-audit job to the CI GitHub Action to confirm there are no vulnerabilities introduced in future PRs.
  • Apply override for socket.io-parser at top-level to ensure dev dependency is always overridden.

Docs

  • Updates README badge that was previously broken:
    Screenshot 2023-05-30 at 4 26 13 PM

Dev Environment

  • Test All - Node VScode launch script added to the Web5 JS workspace configuration.
  • Consistent use and versions of dev dependencies across all projects (e.g., chai, mocha, sinon)

@frankhinek frankhinek changed the title Add code coverage badge to web5 and dids README Add code coverage checks and badges May 29, 2023
@frankhinek
Copy link
Contributor Author

frankhinek commented May 29, 2023

@diehuxx in chatting with @mistermoe and @csuwildcat we'd like to include code coverage but to put in the CONTRIBUTOR.md file rather than at the top of the README badges ...but great to check coverage on every PR.

By highlighting in CONTRIBUTING we make it clear there's an expectation of tests and every PR will have an updated state reviewers can easily glance at.

Something like this:

Screenshot 2023-05-29 at 12 17 23 PM

I'm not sure if istanbul-badges-readme can do this but worth investing and perhaps seeing if we can find something that can.

@frankhinek frankhinek force-pushed the add-code-coverage branch 2 times, most recently from e3aebcb to 58f5b78 Compare May 30, 2023 19:00
@frankhinek frankhinek force-pushed the add-code-coverage branch from 58f5b78 to 4007a56 Compare May 30, 2023 19:09
@codecov
Copy link

codecov bot commented May 30, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@131564a). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #99   +/-   ##
=======================================
  Coverage        ?   65.50%           
=======================================
  Files           ?       31           
  Lines           ?     3383           
  Branches        ?      195           
=======================================
  Hits            ?     2216           
  Misses          ?     1165           
  Partials        ?        2           
Components Coverage Δ
crypto 0.00% <0.00%> (?)
dids 48.61% <0.00%> (?)
web5 81.18% <0.00%> (?)
web5-agent 0.00% <0.00%> (?)
web5-proxy-agent 0.00% <0.00%> (?)
web5-user-agent 79.10% <0.00%> (?)

@frankhinek frankhinek marked this pull request as ready for review May 30, 2023 20:39
@frankhinek frankhinek added documentation Improvements or additions to documentation enhancement New feature or request testing related to new or existing tests dependencies Pull requests that update a dependency file security Security issue labels May 30, 2023
Copy link
Contributor

@mistermoe mistermoe left a comment

Choose a reason for hiding this comment

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

this is awesome @frankhinek and @diehuxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation enhancement New feature or request security Security issue testing related to new or existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants