Skip to content

Commit 4a394d4

Browse files
committed
adding Jakefile
1 parent 5d44bdc commit 4a394d4

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

Jakefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
var ISTANBUL = './node_modules/.bin/istanbul';
2+
var COVERAGE_OPTS = '--lines 95 --statements 90 --branches 80 --functions 90';
3+
4+
var print_opts = {printStdout: true, printStderr: true};
5+
6+
desc("Run jake test and jake lint");
7+
task('default', ['lint', 'test'], {async: true}, complete);
8+
9+
desc('Run tests and check test coverage');
10+
task('test', ['test:cover', 'test:check-coverage'], {async: true}, complete);
11+
12+
namespace('test', function() {
13+
desc('Run tests with test coverage');
14+
task('cover', {async: true}, function(args) {
15+
var command = ISTANBUL + " cover test/run.js";
16+
jake.exec(command, complete, print_opts);
17+
});
18+
19+
desc('Check test coverage');
20+
task('check-coverage', {async: true}, function(args) {
21+
var command = ISTANBUL + " check-coverage " + COVERAGE_OPTS;
22+
jake.exec(command, complete, print_opts);
23+
});
24+
25+
desc('Run acceptance tests');
26+
task('acceptance', {async: true}, function() {
27+
var command = "test/run.js -T acceptance --timeout 30000";
28+
jake.exec(command, complete, print_opts);
29+
});
30+
});
31+
32+
var JSHINT = './node_modules/jshint/bin/hint --config .jshintrc';
33+
34+
desc('Run jshint against src and test directories');
35+
task('lint', {async: true}, function() {
36+
var commands = [
37+
"echo linting..",
38+
JSHINT + ' ./lib',
39+
JSHINT + ' ./test'
40+
];
41+
jake.exec(commands, complete, print_opts);
42+
});

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A basic boilerplate for NodeJS REST API applications that emphasizes code consis
1212
* [istanbul](https://github.com/yahoo/istanbul) test coverage framework.
1313
* [jshint](http://jshint.com/) code linting.
1414
* [restify](http://mcavage.github.com/node-restify/) REST framework.
15+
* choice between make and [jake](https://github.com/mde/jake) build tool.
1516
* choice of combined or separate servers for each 'app'.
1617
* servers can run on multiple ports.
1718

@@ -28,7 +29,7 @@ Assuming you already have NodeJS 0.8.11 or higher installed:
2829
npm install .
2930
make
3031

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+
The `jake` or `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`.
3233

3334
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.
3435

@@ -39,6 +40,9 @@ To run the acceptance tests (which are just mocha tests), first start the server
3940
Then:
4041

4142
make test-acceptance
43+
or:
44+
45+
jake test:acceptance
4246

4347
You can launch the sever on more than one port via `bin/launch`, for example:
4448

lib/app.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
var restify = require('restify');
21
var Settings = require('settings');
32
var config = new Settings(require('../config'));
43
var AppServer = require('./server/app_server');

0 commit comments

Comments
 (0)