Before submitting a pull request, contributors are requested to observe the following procedure:
-
Documents. Read the following documents and comply with the guidelines stated therein:
- Project Proposal and Standards - Refer to this document for the coding standards and the team workflow.
- Continuous Integration Plan - Refer to this document for the updated team workflow with the addition of the CI/CD pipeline.
-
.env. Secure a copy of the.envfile from the developers.IMPORTANT: Make sure that the
testing-modevariable is set toon. This directs all the database operations to the test database (leaving the production database unaffected).On the off chance that it is assigned a different value:
- Set
testing-modetoon; - Kill all
nodeprocesses; - Restart the server; and
- Verify that you are working with the test database before proceeding.
- Set
-
Linting. This project uses ESLint for linting and enforcing uniform and consistent coding style. Run the following command to flag issues:
npm run lintTo automatically fix some of the issues (namely those that can be resolved by ESLint), run the following command:
npm run lint-fixIf ESLint is already globally installed in your system, verify that it uses this project's configuration file:
.eslintrc.json.The linter also flags missing and invalid JSDoc documentation as errors. Hence, it is imperative to properly document additional methods and update the documentation of modified functions, especially if the changes are substantial.
-
Unit Testing. Write unit tests for additional methods and maintain a code coverage of least 80%. Note that unit tests should not include any database connections (even to mock databases) since these already fall under the purview of integration tests (performed by the Quality Assurance team). To test controller methods that involve database operations, use spying, stubbing, or mocking instead.
The command to run the unit tests is as follows:
npm run testTo generate HTML reports for the unit test results and code coverage (which may be helpful in visualizing failed test cases or uncovered code), run the following command:
npm run test-report
IMPORTANT: The workflow currently includes three pull request-triggered checks:
- Node.js CI / build
- Node.js CI / test
- GitGuardian security checks
Failing any one of these three checks will result in the rejection of the pull request.