forked from jamesshore/lab1_grunt_shootout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
87 lines (72 loc) · 1.88 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
// Copyright (c) 2012 Titanium I.T. LLC. All rights reserved. See LICENSE.txt for details.
"use strict";
var karma = require("./build/util/karma_runner.js");
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
browser: {
options: browserLintOptions(),
src: "src/client/**/*.js"
},
node: {
options: nodeLintOptions(),
src: ["src/*.js", "src/server/**/*.js", "build/util/**/*.js", "*.js"]
}
},
nodeunit: {
all: ["src/_*_test.js", "src/server/**/_*_test.js"]
},
karma: {
server: {
configFile: "build/config/karma.conf.js"
}
},
runKarma: {
// Modify (or comment out) the following list to cause the build to fail unless these browsers are tested.
requiredBrowsers: [
"IE 8.0.0 (Windows 7)",
"IE 9.0.0 (Windows 7)",
"Firefox 26.0.0 (Mac OS X 10.8)",
"Chrome 31.0.1650 (Mac OS X 10.8.5)",
"Safari 6.1.1 (Mac OS X 10.8.5)",
"Mobile Safari 7.0.0 (iOS 7.0.3)"
]
}
});
grunt.registerTask("default", "Lint and test", ["jshint", "test"]);
grunt.registerTask("test", "Test everything", ["nodeunit", "runKarma"]);
grunt.registerTask("runKarma", "Test browser code", function() {
karma.runTests(grunt.config("runKarma.requiredBrowsers"), this.async(), grunt.warn);
});
grunt.loadNpmTasks("grunt-karma");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-nodeunit");
function globalLintOptions() {
return {
bitwise: true,
curly: false,
eqeqeq: true,
forin: true,
immed: true,
latedef: false,
newcap: true,
noarg: true,
noempty: true,
nonew: true,
regexp: true,
undef: true,
strict: true,
trailing: true
};
}
function nodeLintOptions() {
var options = globalLintOptions();
options.node = true;
return options;
}
function browserLintOptions() {
var options = globalLintOptions();
options.browser = true;
return options;
}
};