|
1 | 1 | nodejs-tdd-boilerplate |
2 | 2 | ====================== |
3 | 3 |
|
4 | | -#NodeJS TDD Boilerplate |
| 4 | +# NodeJS TDD Boilerplate |
5 | 5 |
|
6 | | -##Features |
| 6 | +A basic boilerplate for NodeJS REST API applications that emphasizes code consistency and excellent test coverage. |
7 | 7 |
|
8 | | -* mocha test framework. |
9 | | -* sinon stubbing framework. |
10 | | -* istanbul test coverage framework. |
11 | | -* jshint code linting. |
12 | | -* restify REST framework. |
| 8 | +## Features |
| 9 | + |
| 10 | +* [mocha](https://github.com/visionmedia/mocha) test framework. |
| 11 | +* [sinon](http://sinonjs.org) stubbing framework. |
| 12 | +* [istanbul](https://github.com/yahoo/istanbul) test coverage framework. |
| 13 | +* [jshint](http://jshint.com/) code linting. |
| 14 | +* [restify](http://mcavage.github.com/node-restify/) REST framework. |
| 15 | +* choice of combined or separate servers for each 'app'. |
| 16 | +* servers can run on multiple ports. |
| 17 | + |
| 18 | +## Planned |
| 19 | +* Actual model implementation example instead of stubbed model. |
| 20 | +* Bamboo integration example. |
| 21 | + |
| 22 | +## Setup |
| 23 | + |
| 24 | +Assuming you already have NodeJS 0.8.11 or higher installed: |
| 25 | + |
| 26 | + git clone https://github.com/BryanDonovan/nodejs-tdd-boilerplate.git |
| 27 | + cd nodejs-tdd-boilerplate |
| 28 | + npm install . |
| 29 | + make |
| 30 | + |
| 31 | +The `make` command will run JSHint, all the mocha unit tests, and check the test coverage. To view the test coverage report, open coverage/lcov-report/index.html after running `make`. |
| 32 | + |
| 33 | +You can also run `make test` to just run the tests with coverage, `make test-cov` to run the tests and attempt to open the coverage report in your browser, and `make lint` to run JSHint. |
| 34 | + |
| 35 | +To run the acceptance tests (which are just mocha tests), first start the server: |
| 36 | + |
| 37 | + bin/start all |
| 38 | + |
| 39 | +Then: |
| 40 | + |
| 41 | + make test-acceptance |
| 42 | + |
| 43 | +You can launch the sever on more than one port via `bin/launch`, for example: |
| 44 | + |
| 45 | + bin/launch users |
| 46 | + |
| 47 | +.. will launch the users app on two ports (specified in config.js). |
| 48 | + |
| 49 | +Then you can run the acceptance tests against either of those ports by specifying the PORT env variable: |
| 50 | + |
| 51 | + PORT=12100 make test-acceptance |
0 commit comments