forked from facultymatt/angular-unsavedChanges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
139 lines (125 loc) · 3.48 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
127
128
129
130
131
132
133
134
135
136
137
138
139
// @todo configure grunt default stuff to run on every save so we know that
// dist is always up to date and jsLinted
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt, {
scope: ['dependencies', 'devDependencies']
});
grunt.initConfig({
// end 2 end testing with protractor
protractor: {
options: {
keepAlive: false,
configFile: './protractor.conf.js'
},
singlerun: {},
travis: {
configFile: './protractor_travis.conf.js'
},
auto: {
keepAlive: true,
options: {
args: {
seleniumPort: 4444
}
}
}
},
connect: {
server: {
options: {
port: 9001,
open: 'http://localhost:9001/demo',
keepalive: true
}
},
// our protractor server
testserver: {
options: {
port: 9999
}
},
travisServer: {
options: {
port: 9999
}
},
},
// watch tasks
// Watch specified files for changes and execute tasks on change
watch: {
livereload: {
options: {
livereload: true
},
files: [
'src/*.js',
'demo/*.js'
],
tasks: ['jshint']
},
},
karma: {
plugins: [
'karma-osx-reporter'
],
unit: {
configFile: 'karma-unit.conf.js',
autoWatch: false,
singleRun: true
},
unitAuto: {
configFile: 'karma-unit.conf.js',
autoWatch: true,
singleRun: false
}
},
'min': {
'dist': {
'src': ['dist/unsavedChanges.js'],
'dest': 'dist/unsavedChanges.min.js'
}
},
jshint: {
all: ['src/*.js']
},
strip: {
main: {
src: 'src/unsavedChanges.js',
dest: 'dist/unsavedChanges.js'
}
}
});
grunt.registerTask('test', [
'test:unit'
]);
grunt.registerTask('server', [
'connect:server'
]);
grunt.registerTask('test:unit', [
'karma:unit'
]);
grunt.registerTask('autotest', [
'autotest:unit'
]);
grunt.registerTask('autotest:unit', [
'karma:unitAuto'
]);
grunt.registerTask('default', [
'jshint',
'strip:main',
'min'
]);
grunt.registerTask('autotest:e2e', [
'connect:testserver', // - starts the app so the test runner can visit the app
'shell:selenium', // - starts selenium server in watch mode
'watch:protractor' // - watches scripts and e2e specs, and starts tests on file change
]);
grunt.registerTask('test:e2e', [
'connect:testserver', // - run concurrent tests
'protractor:singlerun' // - single run protractor
]);
grunt.registerTask('test:travis', [
'connect:travisServer', // - run concurrent tests
'karma:unit' // - single run karma unit
]);
};