forked from linagora/linagora.esn.calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile-tests.js
91 lines (82 loc) · 2.55 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
'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']
}
},
midway: {
options: {
common: ['test/midway-backend/all.js'],
target: 'mochacli:midway'
},
files: {
src: ['test/midway-backend/**/*.js']
}
}
},
mochacli: {
options: {
flags: process.env.INSPECT ? ['--debug-brk', '--inspect'] : [],
require: ['chai', 'mockery'],
reporter: 'spec',
timeout: process.env.TEST_TIMEOUT || 20000,
env: {
ESN_CUSTOM_TEMPLATES_FOLDER: 'testscustom'
}
},
backend: {
options: {
files: ['test/unit-backend/all.js', grunt.option('test') || 'test/unit-backend/**/*.js']
}
},
midway: {
options: {
files: ['test/midway-backend/all.js', grunt.option('test') || 'test/midway-backend/**/*.js']
}
}
},
karma: {
unit: {
configFile: './test/config/karma.conf.js',
browsers: ['PhantomJS'],
reporters: KARMA_REPORTERS
},
all: {
configFile: './test/config/karma.conf.js',
browsers: ['PhantomJS', 'Firefox', 'Chrome'],
reporters: KARMA_REPORTERS
}
}
});
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-mocha-cli');
grunt.loadNpmTasks('grunt-karma');
grunt.loadTasks('tasks');
grunt.registerTask('test-unit-backend', 'run the backend unit tests (to be used with .only)', ['splitfiles:backend']);
grunt.registerTask('test-midway-backend', 'run midway tests (to be used with .only)', ['splitfiles:midway']);
grunt.registerTask('test-backend', 'run both the unit & midway tests', ['test-unit-backend', 'test-midway-backend']);
grunt.registerTask('test-frontend', 'run the FrontEnd tests', ['karma:unit']);
grunt.registerTask('test-frontend-all', 'run the FrontEnd tests on all possible browsers', ['karma:all']);
grunt.registerTask('test', ['test-backend', 'test-frontend']);
grunt.registerTask('default', ['test']);
};