DEV Community

Discussion on: What are the best practices for accepting PRs?

Collapse
 
dmfay profile image
Dian Fay • Edited

Two essential things:

  1. Automate your unit/integration tests. Your options for testing frameworks depend mostly on what language you're using. With JavaScript, you could use Mocha, AVA, Jest, tape, or a number of others. When you change code, update existing tests and add new ones to cover behavioral changes. Require the same of pull requests in your contributing guidelines. Having a robust battery of tests lets you validate code with a single command, and you can evaluate whether code does what it's supposed to by reviewing the tests.
  2. Some form of continuous integration. Most of the newer generation of CI services are easy to integrate with GitHub and other repository hosts; GitLab has its own. CI should run on every pull request, testing the merge and running your automated tests so you know immediately if a pull request breaks tests.

Beyond that, you can automate test coverage reporting with something like Coveralls. If a pull request drops coverage substantially, that's a sign that it contains functionality which isn't being tested and should be considered unpredictable.