forked from yearofmoo-articles/AngularJS-Testing-Article
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
119 lines (108 loc) · 3.04 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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-karma');
grunt.initConfig({
shell: {
install: {
command: 'node ./node_modules/bower/bin/bower install'
},
font_awesome_fonts: {
command: 'cp -R components/components-font-awesome/font app/font'
}
},
connect: {
options: {
port: 8000,
base: './app'
},
server: {
options: {
keepalive: true
}
},
testserver: {}
},
karma: {
unit: {
configFile: './test/karma-unit.conf.js',
autoWatch: false,
singleRun: true
},
unit_auto: {
configFile: './test/karma-unit.conf.js'
},
midway: {
configFile: './test/karma-midway.conf.js',
autoWatch: false,
singleRun: true
},
midway_auto: {
configFile: './test/karma-midway.conf.js'
},
e2e: {
configFile: './test/karma-e2e.conf.js',
autoWatch: false,
singleRun: true
},
e2e_auto: {
configFile: './test/karma-e2e.conf.js'
}
},
watch: {
scripts: {
files: ['app/scripts/**/*.js','app/styles/**/*.css'],
tasks: ['concat'],
options: {
nospawn: true
},
},
},
concat: {
styles: {
dest: './app/assets/app.css',
src: [
'app/styles/reset.css',
'components/components-font-awesome/css/font-awesome.css',
'components/bootstrap.css/css/bootstrap.css',
'app/styles/app.css'
]
},
scripts: {
options: {
separator: ';'
},
dest: './app/assets/app.js',
src: [
'components/angularjs/index.js',
'app/scripts/lib/router.js',
'app/scripts/config/config.js',
'app/scripts/services/**/*.js',
'app/scripts/directives/**/*.js',
'app/scripts/controllers/**/*.js',
'app/scripts/filters/**/*.js',
'app/scripts/config/routes.js',
'app/scripts/app.js',
]
},
}
});
grunt.registerTask('test:e2e', ['connect:testserver', 'karma:e2e']);
grunt.registerTask('test', ['karma:unit', 'karma:midway', 'test:e2e']);
//keeping these around for legacy use
grunt.registerTask('autotest:unit', ['karma:unit_auto']);
grunt.registerTask('autotest:midway', ['karma:midway_auto']);
grunt.registerTask('autotest:e2e', ['karma:e2e_auto']);
grunt.registerTask('autotest', ['karma:unit_auto']);
//installation-related
grunt.registerTask('install', ['shell:install','shell:font_awesome_fonts']);
//defaults
grunt.registerTask('default', ['dev']);
//development
grunt.registerTask('dev', ['install','concat','watch']);
grunt.registerTask('server', ['connect:server']);
};