forked from SEED-platform/seed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
125 lines (115 loc) · 4.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
120
121
122
123
124
125
var tmp = require('tmp');
module.exports = function(grunt) {
grunt.initConfig({
// connect: {
// options: {
// port: 8000,
// hostname: 'localhost'
// },
// runtime: {
// options: {
// middleware: function (connect) {
// return [
// lrSnippet,
// mountFolder(connect, 'protractorInstrumented'),
// mountFolder(connect, '.......')
// ];
// }
// }
// }
// Before generating any new files, remove any previously-created files.
// },
clean: {
options: {
force:true
},
tests: ['tmp', 'build', 'protractorInstrumented', 'protractorCoverage', 'protractorReports', 'protractorSaved'],
},
connect: {
server: {
options: {
port: 3000,
base: 'protractorInstrumented/seed/static/seed/js'
}
},
},
instrument: {
files: ['seed/static/seed/js/**/*.js','!seed/static/seed/js/decorators/**/*.js', '!seed/static/seed/js/seed.js'],
options: {
lazy: true,
basePath: "protractorInstrumented"
}
},
copy: {
'save': {
expand: true,
cwd: 'seed/static/seed/js',
src: '**',
dest: 'protractorSaved/'
},
'instrument': {
expand: true,
cwd: 'protractorInstrumented/seed/static/seed/js',
src: '**',
dest: 'seed/static/seed/js/'
},
'copyBack': {
expand: true,
cwd: 'protractorSaved',
src: '**',
dest: 'seed/static/seed/js/'
},
},
protractor_coverage: {
options: {
keepAlive: false, // If false, the grunt process stops when the test fails.
noColor: false,
coverageDir: 'protractorCoverage',
args: {
baseUrl: 'http://localhost:8000'
}
},
local: {
options: {
configFile: 'seed/static/seed/tests/protractor-tests/protractorConfigCoverage.js'
}
}
},
makeReport: {
src: 'protractorCoverage/**/*.json',
options: {
type: 'lcov',
dir: 'protractorReports',
print: ''
}
},
coveralls: {
main:{
src: 'protractorReports/**/*.info',
options: {
force: true
},
},
},
});
// Actually load this plugin's task(s).
// grunt.loadTasks('tasks');
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-protractor-coverage');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-istanbul');
grunt.loadNpmTasks('grunt-coveralls');
// Whenever the "test" task is run, first clean the "tmp" dir, then run this
// plugin's task(s), then test the result.
//same as npm test more or less
// grunt.registerTask('coverage', ['protractor_coverage:local']);
//don't use instrumented code
// grunt.registerTask('coverage', ['clean', 'copy:save', 'instrument', 'protractor_coverage:local', 'copy:copyBack']);
//without coveralls
grunt.registerTask('coverage', ['clean', 'copy:save', 'instrument', 'copy:instrument', 'protractor_coverage:local', 'copy:copyBack', 'makeReport']);
grunt.registerTask('report', ['makeReport']);
//with coveralls
// grunt.registerTask('coverage', ['clean', 'copy:save', 'instrument', 'copy:instrument', 'protractor_coverage:local', 'copy:copyBack', 'makeReport', 'coveralls']);
grunt.registerTask('test', ['coverage']);
};