brianc / node-pg-types

Type parsing for node-postgres
268 stars 55 forks source link

Add code coverage to CI #97

Closed sehrope closed 5 years ago

sehrope commented 5 years ago

Adds some code coverage report generation to Travis. This will create it as part of CI but I think you need to authorize / enable it to explicitly publish a comment to the PR with a report: https://docs.codecov.io/docs/pull-request-comments

Here's a sample of what get's generated for this PR: https://codecov.io/gh/sehrope/node-pg-types/tree/f502355098394ae3e159a28552c6c6caa2680eba

Existing coverage is pretty good (nice!) and most of what's missing is things we've already identified (ex: binary arrays).

Also, noticed that the travis config had an extra env var, PGUSER, that wasn't being referenced anywhere. It's been there since first adding that file so probably a part of wherever it was copied from (I'm guessing pg).

If you want to run coverage locally you do it via:

npx nyc --reporter=html npm test && npx open-cli coverage/index.html
codecov-io commented 5 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@afead5b). Click here to learn what that means. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #97   +/-   ##
=========================================
  Coverage          ?   80.33%           
=========================================
  Files             ?        5           
  Lines             ?      300           
  Branches          ?        0           
=========================================
  Hits              ?      241           
  Misses            ?       59           
  Partials          ?        0

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update afead5b...8542d0b. Read the comment docs.

sehrope commented 5 years ago

Okay I guess the comments are already enabled :+1:

sehrope commented 5 years ago

We've used this module extensively through pg for years so happy to help.

sehrope commented 5 years ago

Rebased atop master, added the coverage items as dev dependencies, added coverage and coverage-ci npm scripts, and also added one more commit to cleanup the .PHONY line in the Makefile as it had a typo with a non-existent target (needed to update it anyway to add "coverage" to it).

sehrope commented 5 years ago

:tada: