-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
85 lines (71 loc) · 1.72 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
module.exports = function(grunt) {
var gruntConfig = {};
// jasmine task
grunt.loadNpmTasks('grunt-contrib-jasmine');
gruntConfig.jasmine = {
options: {
specs: 'test/**/*_spec.js',
version: '2.0.0',
outfile: 'SpecRunner.html',
keepRunner: true,
summary: true,
host : 'http://127.0.0.1:8080/'
}
};
// test all task
gruntConfig.jasmine.all = {
src: 'src/**/*.js',
};
gruntConfig.jasmine.teamcity = {
src: 'src/**/*.js',
options: {
helpers: [
'jasmine-reporters/src/jasmine.teamcity_reporter.js',
'test/harness.js'
]
}
};
// coverage task
gruntConfig.jasmine.istanbul = {
src: 'src/**/*.js',
options: {
template: require('grunt-template-jasmine-istanbul'),
templateOptions: {
coverage: 'coverage/coverage.json',
report: 'coverage/report'
}
}
};
// connect task
grunt.loadNpmTasks('grunt-contrib-connect');
gruntConfig.connect = {
options: {
port: 8080,
hostname: '*'
}
};
gruntConfig.connect.server = {
options: {
keepalive: true,
debug: true
}
};
gruntConfig.connect.test = {
options: {}
}
// clean task
grunt.loadNpmTasks('grunt-contrib-clean');
gruntConfig.clean = {
all: {
src: ['SpecRunner.html', 'coverage']
}
};
// Project configuration.
grunt.initConfig(gruntConfig);
// Default task(s).
grunt.registerTask('default', []);
grunt.registerTask('server', ['connect:server']);
grunt.registerTask('test', ['connect:test', 'jasmine:all']);
grunt.registerTask('teamcity', ['connect:test', 'jasmine:teamcity']);
grunt.registerTask('coverage', ['connect:test', 'jasmine:istanbul']);
};