how do we test nodejs apps?
TRANSCRIPT
How we do test apps
HotelQuickly Approach●Git flow
●Pull Request
●Code Quality Tool
●Unit tests
● Integration tests
●Continuous integration
Git flow
The main branches (infinite lifetime):
● master (production-ready state)
● develop (the latest delivered development changes for the next release)
Supporting branches:
● feature branches
● release branches
● hotfix branches
Sample App ModelActions:
● find offers
● book hotel
Initialize ApplicationWeb framework expressjs
●npm init
●npm install express … --save-dev
https://github.com/HotelQuickly/nodejs-meetup
git checkout step1
Find offersModules
●mysql2 mysql driver (fast)
●knex query buildergit checkout step2
Time to DockerDocker allows you to package an application with all of its dependencies into a standardized unit for software development ©
Docker●Dockerfile
●Build image
●Publish image
●Start containergit checkout step3
Modules
●mochajs test runner
●shouldjs assertion library
●supertest
●sql-fixtures
●chancejs minimalist generator of random
Integration tests
git checkout step4
Note: don’t install mocha globally
Code Quality●eslint
●HotelQuickly config
git checkout step5
Book hotelNOTE: custom errors in node.js
git checkout step6
Modules●sinonjs Spies, Stubs and Mocks
●proxyquire
Unit tests
git checkout step7
git checkout step8
Integration tests
Continuous integration●Docker compose
●Travis
git checkout step9
QuestionsThanks for coming!