Code Quality, Testing, and Security - kkemple/awesome-enterprise-web-service GitHub Wiki

In order to keep the code clean and well structured ESLint is used. Rules are based off of Airbnb's style guide with some very minor modifications, see .eslintrc for config.

Testing is done with tape, sinon, and nock for mocking HTTP calls. There are separate NPM tasks for running units tests, running full test suite, and running full test suite with code coverage.

You will need a database and redis instance running to run full test suite

Vulnerabilities are also checked for via nsp. NSP is the Node Security Project module for checking your application's dependencies against the database of known NPM module vulrnerabilities.

NPM Test Scripts

{
  "lint": "eslint .",
  "audit": "nsp check",
  "pretest": "npm run lint",
  "test": "npm run db:migrate && npm run db:seed:all && istanbul cover tape -- -r babel-register \"src/**/*.test.js\"",
  "test:coverage": "npm run test && codeclimate-test-reporter < coverage/lcov.info",
  "pretest:unit": "npm run lint",
  "test:unit": "tape -r babel-register \"src/**/unit.test.js\""
}