|
| 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 | +}); |
0 commit comments