forked from akamai/mpulse-query.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
192 lines (177 loc) · 3.77 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/* eslint-env node */
/**
* @namespace BuildConfiguration
* @desc
* Documents the constants used during build and compilation as builtin
* compilation and build configuration documentation
*
* The build is executed through Grunt the generic taskrunner.
*/
/**
* @constant mochaTestFiles
* @memberof BuildConfiguration
* @type {String[]}
* @desc
* Array of files to use to run the Unittests on the code base
*/
var mochaTestFiles = [
"tests/blanket.js",
"tests/index.js",
"tests/base/*.js",
"tests/logging/*.js"
];
/**
* @constant coverageHtml
* @memberof BuildConfiguration
* @type {string}
* @desc
* Destination path to the unittest coverage report
*/
var coverageHtml = "tests/results/coverage.html";
/**
* @constant junitReportFile
* @memberof BuildConfiguration
* @type {string}
* @desc
* Destination path for the JUnit XML format report of the UnitTest run
*/
var junitReportFile = "tests/results/junit.xml";
/**
* @constant jsdocSourceFiles
* @memberof BuildConfiguration
* @type {String[]}
* @desc
* Array of file sources to generate the documentation from
*/
var jsdocSourceFiles = [
"lib/**/*.js",
"./*.js",
"node_modules/soasta-repository/lib/**/*.js"
];
/**
* @constant jsdocTutorialPath
* @memberof BuildConfiguration
* @type {string}
* @desc
* Directory containing tutorials and other documentation not to be distributed as source code files
*/
var jsdocTutorialPath = "doc/tutorials";
/**
* @constant sourcePaths
* @memberof BuildConfiguration
* @type {string[]}
* @desc
* A list of all paths to javascript files
*/
var sourcePaths = [
"./lib/**/*.js",
"./Gruntfile.js",
"./index.js",
"./tests/**/*.js"
];
module.exports = function(grunt) {
"use strict";
var lintFiles = [
"*.js",
"cli/*.js",
"lib/**/*.js",
"test/*.js"
];
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
eslint: {
console: {
options:{
"format": "compact"
},
src: lintFiles
},
build: {
options: {
"output-file": "eslint.xml",
"format": "jslint-xml",
"silent": true
},
src: lintFiles
}
},
mochaTest: {
test: {
options: {
reporter: "tap",
captureFile: "test/mocha.tap"
},
src: [
"test/*.js"
]
}
},
karma: {
options: {
singleRun: true,
colors: true,
configFile: "./karma.config.js",
preprocessors: {
"./src/*.js": ["coverage"]
},
basePath: "./",
files: [
"lib/mocha/mocha.css",
"lib/mocha/mocha.js",
"lib/node-assert/assert.js",
"lib/assertive-chai/dist/assertive-chai.js",
"src/mpulse.js",
"test/*.js"
]
},
console: {
browsers: ["PhantomJS"],
frameworks: ["mocha"]
}
},
jsdoc: {
dist: {
options: {
destination: "doc",
readme: "README.md",
package: "package.json",
template : "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template",
configure : "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template/jsdoc.conf.json",
tutorials: "./doc/tutorials",
verbose: true,
plugins: [
"node_modules/grunt-jsdoc/node_modules/jsdoc/plugins/markdown"
]
},
src: jsdocSourceFiles
}
},
bower: {
install: {
options: {
targetDir: "lib"
}
}
}
});
//
// Plugins
//
grunt.loadNpmTasks("grunt-bower-task");
grunt.loadNpmTasks("grunt-karma");
grunt.loadNpmTasks("grunt-mocha-test");
grunt.loadNpmTasks("gruntify-eslint");
grunt.loadNpmTasks("grunt-jsdoc");
//
// Tasks
//
grunt.registerTask("test", ["bower:install", "mochaTest", "karma:console"]);
grunt.registerTask("lint", ["eslint:console"]);
grunt.registerTask("lint:build", ["eslint:build"]);
//
// Task Groups
//
grunt.registerTask("default", ["lint"]);
grunt.registerTask("all", ["lint:build", "test"]);
};