Continuous Integration, Code Coverage & Deployment with Codeship
Local Git -> git push -> Github -> Code Ship -> run test, test pass -> Deploy to Heroku
npm install -g istanbulto see code coverage- Make sure tests are passing
- In app.js, add
var port = process.env.PORT || 3000make sureapp.listen(port)at the bottom of app.js,module.exports = app - In test file, include
var app = require(../app) - In package.json, include
"scripts": { "start" : "node app.js", "dev" : "nodemon app.js", "cover" : "istanbul cover _mocha" } - in terminal,
npm run coverto see the test coverage by istanbul - Create your heroku app via dashboard
- Create github repo on Github.
- On your CLI,
git initandgit remote add origin your-url create and configure Code Ship
- Set up commands:
nvm install 6.2.2 npm install npm install -g mocha npm install -g istanbul npm install -g codeclimate-test-reporter - Test pipelines
npm run cover CODECLIMATE_REPO_TOKEN if you're using codeclimate (copy from codeclimate)
- Set up commands:
Push to github and watch the build on Code Ship!