-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathGruntfile.js
More file actions
75 lines (60 loc) · 1.64 KB
/
Gruntfile.js
File metadata and controls
75 lines (60 loc) · 1.64 KB
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
// TODO add githooks
var fs = require("fs");
var pkg = JSON.parse(fs.readFileSync("./package.json"));
var webpackRelease = require("./webpack.config.js");
var webpackDev = require("./webpack.dev.config.js");
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
pkg: pkg,
jshint: {
options: {
jshintrc: true
},
all: ["Gruntfile.js", "src/**/*.js"]
},
webpack: {
release: webpackRelease,
dev: webpackDev,
},
karma: {
options: {
configFile: 'karma.config.js',
},
unit: {
singleRun: true
},
watch: {
background: false,
singleRun: false,
autoWatch: false
}
},
watch: {
test: {
options: {
spawn: false,
interrupt:true
},
files: ["test/**/*.js","src/**/*.js"],
tasks: ["karma:unit:run"]
//tasks: ["karma:watch:run"]
}
}
});
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-mocha-test");
grunt.loadNpmTasks("grunt-webpack");
grunt.loadNpmTasks("grunt-karma");
grunt.registerTask("lint", "jshint:all");
grunt.registerTask("test", "karma:unit");
// FIXME This doesn't work due to bugs in grunt-karma regarding PhantomJs
//grunt.registerTask("testWatch", ["karma:unit", "watch:test"]);
grunt.registerTask("buildRelease", "webpack:release");
grunt.registerTask("buildDev", "webpack:dev");
grunt.registerTask("build", ["buildRelease", "buildDev"]);
// TODO add version bump
grunt.registerTask("release",
["lint", "test", "build"]);
};