-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGruntfile.js
113 lines (96 loc) · 2.34 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
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
/*eslint-env node*/
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
dir: {
webapp: 'app',
tests: 'test',
dist: 'dist',
bower_components: 'bower_components',
localServerTestUrl : 'http://localhost:8080/test-resources'
},
connect: {
options: {
port: 8080,
hostname: '*'
},
src: {},
dist: {}
},
openui5_connect: {
options: {
resources: [
'<%= dir.bower_components %>/openui5/src/sap.ui.core/src',
'<%= dir.bower_components %>/openui5/src/sap.m/src',
'<%= dir.bower_components %>/openui5/src/sap.ui.layout/src',
'<%= dir.bower_components %>/openui5/src/themelib_sap_bluecrystal/src'
]
},
src: {
options: {
appresources: ['.'],
testresources: ['<%= dir.tests %>']
}
},
dist: {
options: {
appresources: '<%= dir.dist %>'
}
}
},
eslint: {
options: {
quiet: true
},
all: ['<%= dir.tests %>', '<%= dir.webapp %>'],
webapp: ['<%= dir.webapp %>']
},
qunit: {
options: {
/* for debugging*/
'--remote-debugger-autorun' : 'yes',
'--remote-debugger-port' : 8000
},
unit: {
options: {
urls: [
'<%= dir.localServerTestUrl %>/unit/unitTests.qunit.html'
]
}
},
opa: {
options: {
urls: [
'<%= dir.localServerTestUrl %>/integration/opaTests.qunit.html'
],
// same as qunits timeout 90 seconds since opa test might take a while
timeout: 900000
}
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-openui5');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-qunit');
// Server task
grunt.registerTask('serve', function(target) {
grunt.task.run('openui5_connect:' + (target || 'src') + ':keepalive');
});
// Linting task
grunt.registerTask('lint', ['eslint:all']);
// Build task
grunt.registerTask('build', ['openui5_preload', 'copy']);
// Test task
grunt.registerTask('test', ['openui5_connect:src', 'qunit:unit', 'qunit:opa']);
grunt.registerTask('unitTest', ['openui5_connect:src', 'qunit:unit']);
grunt.registerTask('opaTest', ['openui5_connect:src', 'qunit:opa']);
// Default task
grunt.registerTask('default', [
'lint:all',
'test'
]);
};