1
- var util = require ( './test/lib/karma-util.js' ) ;
2
1
module . exports = function ( grunt ) {
3
2
4
3
grunt . loadNpmTasks ( 'grunt-shell' ) ;
@@ -7,6 +6,7 @@ module.exports = function(grunt) {
7
6
grunt . loadNpmTasks ( 'grunt-contrib-uglify' ) ;
8
7
grunt . loadNpmTasks ( 'grunt-contrib-concat' ) ;
9
8
grunt . loadNpmTasks ( 'grunt-contrib-connect' ) ;
9
+ grunt . loadNpmTasks ( 'grunt-karma' ) ;
10
10
11
11
grunt . initConfig ( {
12
12
shell : {
@@ -17,26 +17,44 @@ module.exports = function(grunt) {
17
17
command : 'cp -R components/components-font-awesome/font app/font'
18
18
}
19
19
} ,
20
+
20
21
connect : {
22
+ options : {
23
+ port : 8000 ,
24
+ base : './app'
25
+ } ,
21
26
server : {
22
27
options : {
23
- port : 8000 ,
24
- hostname : '0.0.0.0' ,
25
- base : './app' ,
26
28
keepalive : true
27
29
}
28
- }
29
- } ,
30
- test : {
31
- unit : './test/karma-unit.conf.js' ,
32
- midway : './test/karma-midway.conf.js' ,
33
- e2e : './test/karma-e2e.conf.js'
30
+ } ,
31
+ testserver : { }
34
32
} ,
35
- autotest : {
36
- unit : './test/karma-unit.conf.js' ,
37
- midway : './test/karma-midway.conf.js' ,
38
- e2e : './test/karma-e2e.conf.js'
33
+
34
+ karma : {
35
+ unit : {
36
+ configFile : './test/karma-unit.conf.js' ,
37
+ autoWatch : false ,
38
+ singleRun : true
39
+ } ,
40
+ unit_auto : {
41
+ configFile : './test/karma-unit.conf.js'
42
+ } ,
43
+ midway : {
44
+ configFile : './test/karma-midway.conf.js' ,
45
+ autoWatch : false ,
46
+ singleRun : true
47
+ } ,
48
+ midway_auto : {
49
+ configFile : './test/karma-midway.conf.js'
50
+ } ,
51
+ e2e : {
52
+ configFile : './test/karma-e2e.conf.js' ,
53
+ autoWatch : false ,
54
+ singleRun : true
55
+ }
39
56
} ,
57
+
40
58
watch : {
41
59
scripts : {
42
60
files : [ 'app/scripts/**/*.js' , 'app/styles/**/*.css' ] ,
@@ -46,6 +64,7 @@ module.exports = function(grunt) {
46
64
} ,
47
65
} ,
48
66
} ,
67
+
49
68
concat : {
50
69
styles : {
51
70
dest : './app/assets/app.css' ,
@@ -54,7 +73,7 @@ module.exports = function(grunt) {
54
73
'components/components-font-awesome/css/font-awesome.css' ,
55
74
'components/bootstrap.css/css/bootstrap.css' ,
56
75
'app/styles/app.css'
57
- ]
76
+ ]
58
77
} ,
59
78
scripts : {
60
79
options : {
@@ -76,13 +95,8 @@ module.exports = function(grunt) {
76
95
}
77
96
} ) ;
78
97
79
- grunt . registerMultiTask ( 'test' , 'Run and watch the unit tests with Karma' , function ( ) {
80
- util . startKarma . call ( util , this . data , true , this . async ( ) ) ;
81
- } ) ;
82
-
83
- grunt . registerMultiTask ( 'autotest' , 'Run and watch the unit tests with Karma' , function ( ) {
84
- util . startKarma . call ( util , this . data , false , this . async ( ) ) ;
85
- } ) ;
98
+ grunt . registerTask ( 'test:e2e' , [ 'connect:testserver' , 'karma:e2e' ] ) ;
99
+ grunt . registerTask ( 'test' , [ 'karma:unit' , 'karma:midway' , 'test:e2e' ] ) ;
86
100
87
101
//installation-related
88
102
grunt . registerTask ( 'install' , [ 'shell:install' , 'shell:font_awesome_fonts' ] ) ;
0 commit comments