This repository has been archived by the owner on Feb 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 296
/
Gruntfile-tests.js
78 lines (71 loc) · 1.95 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
'use strict';
/**
*
* @param {object} grunt
*/
module.exports = function(grunt) {
require('time-grunt')(grunt);
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: {
require: ['chai', 'mockery'],
reporter: 'spec',
timeout: process.env.TEST_TIMEOUT || 3000
},
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']
}
}
});
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', ['test-backend', 'test-frontend']);
grunt.registerTask('default', ['test']);
};