-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
98 lines (89 loc) · 2.25 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
/* 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/**/*.js"
];
/**
* @constant sourcePaths
* @memberof BuildConfiguration
* @type {string[]}
* @desc
* A list of all paths to javascript files
*/
var sourcePaths = [
"./cli/**/*.js",
"./lib/**/*.js",
"./Gruntfile.js",
"./tests/**/*.js"
];
module.exports = function(grunt) {
"use strict";
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
eslint: {
console: {
options:{
"format": "compact"
},
src: sourcePaths
},
build: {
options: {
outputFile: "eslint.xml",
format: "jslint-xml",
silent: true
},
src: sourcePaths
}
},
mochaTest: {
test: {
options: {
reporter: "spec",
clearRequireCache: true
},
src: mochaTestFiles
},
build: {
options: {
reporter: "tap",
captureFile: "tests/mocha.tap",
clearRequireCache: true
},
src: mochaTestFiles
}
}
});
//
// Plugins
//
grunt.loadNpmTasks("grunt-mocha-test");
grunt.loadNpmTasks("gruntify-eslint");
//
// Tasks
//
grunt.registerTask("test", ["mochaTest:test"]);
grunt.registerTask("test:build", ["mochaTest:build"]);
grunt.registerTask("lint", ["eslint:console"]);
grunt.registerTask("lint:build", ["eslint:build"]);
//
// Task Groups
//
grunt.registerTask("default", ["lint", "test"]);
grunt.registerTask("build", ["lint:build", "test:build"]);
};