-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
126 lines (122 loc) · 3.75 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
'use strict';
var IS_TEAM_CITY = !! process.env.TEAMCITY_VERSION;
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
coverage: {
src: ['test/coverage']
},
all: {
src: ['tmp/']
},
server: {
src: ['../public/app/']
}
},
bower: {
src: {
options: {
targetDir: './app/vendor',
// this will strip component name
layout: 'byComponent',
install: false,
verbose: false,
cleanTargetDir: true,
cleanBowerDir: false,
bowerOptions: {
production: true
}
}
},
test: {
options: {
targetDir: './test/vendor',
// this will strip component name
layout: function () {
return '';
},
install: false,
verbose: false,
cleanTargetDir: true,
cleanBowerDir: false,
bowerOptions: {
production: false
}
}
}
},
concat: {
dist: {
src: ['app/js/angular/**/*.js'],
dest: 'ecSlider.js',
},
},
jshint: {
gruntfile: {
options: {
jshintrc: '.jshintrc'
},
src: 'Gruntfile.js'
},
app: {
options: {
jshintrc: 'app/.jshintrc'
},
src: ['app/js/angular/**/*.js']
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/**/*.js']
}
},
karma: {
unit: {
configFile: IS_TEAM_CITY ? 'config/karma.teamcity.conf.js' : 'config/karma.conf.js'
},
scenario: {
configFile: IS_TEAM_CITY ? 'config/karma.teamcity.e2e.conf.js' : 'config/karma.e2e.conf.js'
}
},
coverage: {
options: {
thresholds: {
'statements': 90,
'branches': 90,
'lines': 90,
'functions': 90
},
dir: 'coverage',
root: 'test'
}
},
plato: {
all: {
options: {
exclude: /\.min\.js$/,
jshint: grunt.file.readJSON('app/.jshintrc'),
complexity: {
logicalor: false,
switchcase: false,
forin: true,
trycatch: true
}
},
files: {
'report': ['app/js/angular/**/*.js']
}
}
}
});
// These plugins provide necessary tasks.
require('load-grunt-tasks')(grunt, ['grunt-!(cli)']);
grunt.registerTask('default', ['clean:all', 'bower', 'lint', 'test', 'concat']);
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('unit', ['clean:coverage', 'karma:unit']);
grunt.registerTask('test', ['bower','lint', 'unit']);
grunt.registerTask('cover', ['coverage']);
grunt.registerTask('report', ['plato']);
grunt.registerTask('pre-commit', ['test', 'report']);
};