This repository has been archived by the owner on Oct 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
101 lines (89 loc) · 3.15 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
expr: true,
"-W086": true
},
all: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js']
},
mochaTest: {
default: {
options: {
reporter: 'dot',
require: "test/setup.js"
},
src: ['test/**/*Test.js']
},
unitOnly: {
options: {
reporter: 'spec',
require: "test/setup.js"
},
src: ['test/**/*Test.js']
},
"html-coverage": {
options: {
reporter: 'html-cov',
require: "test/setup.js",
quiet: true,
captureFile: 'coverage.html'
},
src: ['test/**/*Test.js']
},
"lcov-coverage": {
options: {
reporter: 'mocha-lcov-reporter',
require: "test/setup.js",
quiet: true,
captureFile: 'coverage.lcov'
},
src: ['test/**/*Test.js']
}
},
shell: {
options: {
stderr: false
},
"upload-coverage-report": {
command: './node_modules/.bin/codeclimate < coverage.lcov'
}
},
jsduck: {
main: {
dest: 'docs/output',
src: ['docs/external', 'src'],
options: {
config: 'docs/config.json',
warnings: '-cat_class_missing,-cat_no_match',
warningsExitNonzero: true
}
}
},
watch: {
scripts: {
files: ['src/**/*.js', 'test/**/*Test.js'],
tasks: ['unit']
}
},
clean: ['docs/output', 'coverage.html']
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-jsduck');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('instrument', 'Enalbles instrumentation of source files for code coverage', function() {
require('blanket')({
pattern: '/src/'
});
});
// Default task(s).
grunt.registerTask('default', 'Run jshint and unit tests', ['jshint', 'mochaTest:default']);
grunt.registerTask('unit', 'Run unit tests only, but with verbose output', ['mochaTest:unitOnly']);
grunt.registerTask('coverage', 'Run tests and create code coverage', ['instrument', 'mochaTest:default', 'mochaTest:html-coverage']);
grunt.registerTask('travis', 'Task run by travis ci', ['jshint', 'instrument', 'mochaTest:default', 'mochaTest:lcov-coverage', 'shell:upload-coverage-report']);
grunt.registerTask('docs', 'Create API documentation', ['jsduck']);
};