-
Notifications
You must be signed in to change notification settings - Fork 148
/
Gruntfile-tests.js
166 lines (155 loc) · 5.24 KB
/
Gruntfile-tests.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
'use strict';
module.exports = function(grunt) {
var CI = grunt.option('ci');
var KARMA_REPORTERS = (grunt.option('reporter') || '').split(',').filter(Boolean);
if (!KARMA_REPORTERS.length) {
KARMA_REPORTERS = CI ? ['spec', 'coverage'] : ['dots'];
}
grunt.initConfig({
concat: {
options: {
separator: ';'
}
},
splitfiles: {
options: {
chunk: 10
},
backend: {
options: {
common: ['test/unit-backend/all.js'],
target: 'mochacli:backend'
},
files: {
src: ['test/unit-backend/**/*.js']
}
},
modulesBackend: {
options: {
common: ['test/module-unit-backend-all.js'],
target: 'mochacli:modulesBackend'
},
files: {
src: ['modules/**/test/unit-backend/**/*.js']
}
},
midway: {
options: {
common: ['test/midway-backend/all.js'],
target: 'mochacli:midway'
},
files: {
src: ['test/midway-backend/**/*.js']
}
},
modulesMidway: {
options: {
common: ['test/midway-backend/all.js'],
target: 'mochacli:modulesMidway'
},
files: {
src: ['modules/**/test/midway-backend/**/*.js']
}
},
modulesStorage: {
options: {
common: ['test/unit-storage/all.js'],
target: 'mochacli:modulesStorage'
},
files: {
src: ['modules/**/test/unit-storage/**/*.js']
}
}
},
mochacli: {
options: {
flags: process.env.INSPECT ? ['--debug-brk', '--inspect'] : ['--max-old-space-size=8192'],
debug: false,
require: ['chai', 'mockery'],
reporter: 'spec',
timeout: process.env.TEST_TIMEOUT || 20000,
env: {
ESN_CUSTOM_TEMPLATES_FOLDER: 'testscustom'
},
exit: true
},
backend: {
options: {
files: ['test/unit-backend/all.js', grunt.option('test') || 'test/unit-backend/**/*.js']
}
},
modulesBackend: {
options: {
files: ['test/module-unit-backend-all.js', grunt.option('test') || 'modules/**/test/unit-backend/**/*.js']
}
},
midway: {
options: {
files: ['test/midway-backend/all.js', grunt.option('test') || 'test/midway-backend/**/*.js']
}
},
modulesMidway: {
options: {
files: ['test/midway-backend/all.js', grunt.option('test') || 'modules/**/test/midway-backend/**/*.js']
}
},
storage: {
options: {
files: ['test/unit-storage/all.js', grunt.option('test') || 'test/unit-storage/**/*.js']
}
},
modulesStorage: {
options: {
files: ['test/unit-storage/all.js', grunt.option('test') || 'modules/**/test/unit-storage/**/*.js']
}
}
},
karma: {
unit: {
configFile: './test/config/karma.conf.js',
browsers: ['PhantomJS'],
reporters: KARMA_REPORTERS
},
modulesUnit: {
configFile: './test/config/karma.modules.conf.js',
browsers: ['PhantomJS'],
reporters: KARMA_REPORTERS
},
all: {
configFile: './test/config/karma.conf.js',
browsers: ['PhantomJS', 'Firefox', 'Chrome'],
reporters: KARMA_REPORTERS
},
modulesAll: {
configFile: './test/config/karma.modules.conf.js',
browsers: ['PhantomJS', 'Firefox', 'Chrome'],
reporters: KARMA_REPORTERS
}
},
protractor: {
options: {
configFile: './test/config/protractor.conf.js'
},
all: {}
}
});
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-mocha-cli');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadTasks('tasks');
grunt.registerTask('test-unit-backend', 'run the backend unit tests (to be used with .only)', ['splitfiles:backend']);
grunt.registerTask('test-modules-unit-backend', 'run modules unit backend tests', ['splitfiles:modulesBackend']);
grunt.registerTask('test-midway-backend', 'run midway tests (to be used with .only)', ['splitfiles:midway']);
grunt.registerTask('test-modules-midway-backend', 'run modules midway backend tests', ['splitfiles:modulesMidway']);
grunt.registerTask('test-unit-storage', 'run storage tests', ['mochacli:storage']);
grunt.registerTask('test-modules-unit-storage', 'run modules unit storage tests', ['splitfiles:modulesStorage']);
grunt.registerTask('test-backend', 'run both the unit & midway tests', ['test-unit-backend', 'test-unit-storage', 'test-midway-backend']);
grunt.registerTask('test-frontend', 'run the FrontEnd tests', ['karma:unit']);
grunt.registerTask('test-modules-frontend', 'run the FrontEnd tests of modules', ['karma:modulesUnit']);
grunt.registerTask('test-frontend-all', 'run the FrontEnd tests on all possible browsers', ['karma:all']);
grunt.registerTask('test-modules-frontend-all', 'run the FrontEnd tests of modules on all possible browsers', ['karma:modulesAll']);
grunt.registerTask('test-e2e', 'Launch integration tests', ['protractor:all']);
grunt.registerTask('test', ['test-backend', 'test-frontend']);
grunt.registerTask('default', ['test']);
};