1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | var exec = require('child_process').exec;
|
10 |
|
11 | module.exports = function(grunt) {
|
12 |
|
13 | var tests = ['test/*_test.js'];
|
14 |
|
15 |
|
16 | grunt.initConfig({
|
17 | env: {
|
18 | dev: {
|
19 | APPC_TEST: '1'
|
20 | },
|
21 | cover: {
|
22 | APPC_TEST: '1'
|
23 | }
|
24 | },
|
25 | mochaTest: {
|
26 | options: {
|
27 | timeout: 3000,
|
28 | reporter: 'spec',
|
29 | ignoreLeaks: false,
|
30 | globals: ['requestSSLHooks','requestSSLFingerprints']
|
31 | },
|
32 | src: tests
|
33 | },
|
34 | jshint: {
|
35 | options: {
|
36 | jshintrc: true
|
37 | },
|
38 | src: ['bin/appc','index.js', 'lib/**/*.js', 'test/**/*.js']
|
39 | },
|
40 | kahvesi: { src: tests },
|
41 | clean: ['tmp']
|
42 | });
|
43 |
|
44 |
|
45 | grunt.loadNpmTasks('grunt-mocha-test');
|
46 | grunt.loadNpmTasks('grunt-contrib-jshint');
|
47 | grunt.loadNpmTasks('grunt-contrib-clean');
|
48 | grunt.loadNpmTasks('grunt-kahvesi');
|
49 | grunt.loadNpmTasks('grunt-env');
|
50 |
|
51 |
|
52 | grunt.registerTask('prep', function() {
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | });
|
58 |
|
59 |
|
60 | grunt.registerTask('report', function() {
|
61 | var done = this.async();
|
62 | exec('./node_modules/grunt-kahvesi/node_modules/.bin/istanbul report html', function(err) {
|
63 | if (err) { grunt.fail.fatal(err); }
|
64 | grunt.log.ok('composite test coverage report generated at ./coverage/index.html');
|
65 | return done();
|
66 | });
|
67 | });
|
68 |
|
69 | grunt.registerTask('cover', ['clean', 'env:cover', 'prep', 'kahvesi', 'report']);
|
70 | grunt.registerTask('default', ['clean', 'jshint', 'env:dev', 'prep', 'mochaTest']);
|
71 |
|
72 | };
|