-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathGruntfile.js
88 lines (78 loc) · 2.18 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
/* eslint-disable */
module.exports = function (grunt) {
// Build customizations would be left up to developer to implement.
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-tomcat-deploy');
grunt.loadNpmTasks('grunt-zip');
var servePort = grunt.option('servePort') || 8000;
var port = grunt.option('port') || 8080;
var host = grunt.option('host') || 'localhost';
var path = grunt.option('path') || 'sample';
grunt.initConfig({
karma: {
options: {
// get defaults from karma config
configFile: 'karma.conf.js',
// run all tests once then exit
singleRun: true,
// only show error messages
logLevel: 'ERROR',
},
unit: {
options:{
singleRun: true,
captureTimeout:30000,
reporters : ['junit', 'progress'],
junitReporter: {
outputDir: 'test-reports', // results will be saved as $outputDir/$browserName.xml
outputFile: undefined, // if included, results will be saved as $outputDir/$browserName/$outputFile
suite: '', // suite will become the package name attribute in xml testsuite element
useBrowserName: true // add browser name to report and classes names
}
}
}
},
eslint: {
files: [ 'web/js/buildProject/**/*.js' ]
},
watch: {
options: {
livereload: true
},
js: {
files: [ 'Gruntfile.js', 'web/js/buildProject/**/*.js', 'spec/**/*.js' ],
tasks: ['test']
},
html: {
files: [ 'web/index.html']
}
},
// Tomcat redeploy task still gets its config from tomcat_deploy
// config item
tomcat_deploy: {
host: host,
login: 'tomcat',
password: 'tomcat',
path: '/' + path,
port: port,
war: 'sample.war',
deploy: '/manager/text/deploy',
undeploy: '/manager/text/undeploy'
},
zip: {
war: {
cwd: 'dist',
dest: 'sample.war',
src: ['dist/**']
}
}
});
// Serve dev app locally
grunt.registerTask('serve', [ 'watch' ]);
grunt.registerTask('deploy', ['tomcat_redeploy']);
grunt.registerTask('test', ['eslint', 'karma']);
// JS task
grunt.registerTask('js', [ 'eslint']);
};