merge: Heavenly spec overhaul. (#2563)
[mootools.git] / Gruntfile.js
bloba6ec22b2c401011aecb40d7f1719861f8e029e6c
1 "use strict";
3 module.exports = function(grunt) {
5         require('load-grunt-tasks')(grunt);
7         grunt.initConfig({
8                 'connect': {
9                         testserver: {
10                                 options: {
11                                         // We use end2end task (which does not start the webserver)
12                                         // and start the webserver as a separate process
13                                         // to avoid https://github.com/joyent/libuv/issues/826
14                                         port: 8000,
15                                         hostname: '0.0.0.0',
16                                         middleware: function(connect, options) {
17                                                 return [
18                                                         function(req, resp, next) {
19                                                                 // cache get requests to speed up tests on travis
20                                                                 if (req.method === 'GET') {
21                                                                         resp.setHeader('Cache-control', 'public, max-age=3600');
22                                                                 }
24                                                                 next();
25                                                         },
26                                                         connect.static(options.base)
27                                                 ];
28                                         }
29                                 }
30                         }
31                 },
33                 'packager': {
35                         options: {
36                                 name: 'Core'
37                         },
39                         all: {
40                                 src: 'Source/**/*.js',
41                                 dest: 'mootools-all.js'
42                         },
44                         nocompat: {
45                                 options: {
46                                         strip: ['.*compat'],
47                                         only: '<%= grunt.option("file") && "Core/" + grunt.option("file") %>'
48                                 },
49                                 src: 'Source/**/*.js',
50                                 dest: 'mootools-nocompat.js'
51                         },
53                         specs: {
54                                 options: {
55                                         name: 'Specs'
56                                 },
57                                 src: 'Specs/<%= grunt.option("module") || "**" %>/<%= grunt.option("file") || "*" %>.js',
58                                 dest: 'mootools-specs.js'
59                         },
61                         'specs-nocompat': {
62                                 options: {
63                                         name: 'Specs',
64                                         strip: ['.*compat'],
65                                         only: '<%= grunt.option("file") && "Specs/" + grunt.option("file") %>'
66                                 },
67                                 src: 'Specs/**/*.js',
68                                 dest: 'mootools-specs.js'
69                         }
71                 },
73                 'karma': {
75                         options: {
76                                 captureTimeout: 60000 * 2,
77                                 singleRun: true,
78                                 frameworks: ['jasmine', 'sinon'],
79                                 files: ['Tests/Utilities/*.js', 'mootools-*.js'],
80                                 sauceLabs: {
81                                         username: process.env.SAUCE_USERNAME,
82                                         accessKey: process.env.SAUCE_ACCESS_KEY,
83                                         testName: 'MooTools-Core'
84                                 },
85                                 customLaunchers: {
86                                         chrome_linux: {
87                                                 base: 'SauceLabs',
88                                                 browserName: 'chrome',
89                                                 platform: 'linux'
90                                         },
91                                         firefox_linux: {
92                                                 base: 'SauceLabs',
93                                                 browserName: 'firefox',
94                                                 platform: 'linux'
95                                         },
96                                         opera_win2000: {
97                                                 base: 'SauceLabs',
98                                                 browserName: 'opera',
99                                                 platform: 'Windows 2008',
100                                                 version: '12'
101                                         },
102                                         safari7: {
103                                                 base: 'SauceLabs',
104                                                 browserName: 'safari',
105                                                 platform: 'OS X 10.9',
106                                                 version: '7'
107                                         },
108                                         safari6: {
109                                                 base: 'SauceLabs',
110                                                 browserName: 'safari',
111                                                 platform: 'OS X 10.8',
112                                                 version: '6'
113                                         },
114                                         safari5_osx10_6: {
115                                                 base: 'SauceLabs',
116                                                 browserName: 'safari',
117                                                 version: '5',
118                                                 platform: 'OS X 10.6'
119                                         },
120                                         safari5_win7: {
121                                                 base: 'SauceLabs',
122                                                 browserName: 'safari',
123                                                 version: '5',
124                                                 platform: 'Windows 7'
125                                         },
126                                         ie11: {
127                                                 base: 'SauceLabs',
128                                                 browserName: 'internet explorer',
129                                                 platform: 'Windows 8.1',
130                                                 version: '11'
131                                         },
132                                         ie10: {
133                                                 base: 'SauceLabs',
134                                                 browserName: 'internet explorer',
135                                                 platform: 'Windows 8',
136                                                 version: '10'
137                                         },
138                                         ie9: {
139                                                 base: 'SauceLabs',
140                                                 browserName: 'internet explorer',
141                                                 platform: 'Windows 7',
142                                                 version: '9'
143                                         },
144                                         ie8: {
145                                                 base: 'SauceLabs',
146                                                 browserName: 'internet explorer',
147                                                 platform: 'Windows 7',
148                                                 version: '8'
149                                         },
150                                         ie7: {
151                                                 base: 'SauceLabs',
152                                                 browserName: 'internet explorer',
153                                                 platform: 'Windows XP',
154                                                 version: '7'
155                                         },
156                                         ie6: {
157                                                 base: 'SauceLabs',
158                                                 browserName: 'internet explorer',
159                                                 platform: 'Windows XP',
160                                                 version: '6'
161                                         },
162                                         iphone_7: {
163                                                 base: 'SauceLabs',
164                                                 browserName: 'iphone',
165                                                 platform: 'OS X 10.9',
166                                                 version: '7',
167                                                 deviceOrientation: 'portrait'
168                                         },
169                                         iphone_6_1: {
170                                                 base: 'SauceLabs',
171                                                 browserName: 'iphone',
172                                                 platform: 'OS X 10.8',
173                                                 version: '6.1',
174                                                 deviceOrientation: 'portrait'
175                                         },
176                                         iphone_6: {
177                                                 base: 'SauceLabs',
178                                                 browserName: 'iphone',
179                                                 platform: 'OS X 10.8',
180                                                 version: '6',
181                                                 deviceOrientation: 'portrait'
182                                         }
183                                 },
184                         },
186                         continuous: {
187                                 browsers: ['PhantomJS']
188                         },
190                         sauce1: {
191                                 port: 9876,
192                                 browsers: [
193                                         'chrome_linux', 
194                                         'firefox_linux', 
195                                         'opera_win2000'
196                                 ]
197                         },
199                         sauce2: {
200                                 port: 9877,
201                                 browsers: [
202                                         'safari7',
203                                         'safari6',
204                                         'safari5_osx10_6'
205                                 ],
206                         },
208                         // safari5_win7, ie11 and ie10 are not loading the test page
209                         sauce3: {
210                                 port: 9999,
211                                 browsers: [
212                                         'safari5_win7',
213                                         'ie11',
214                                         'ie10'
215                                 ]
216                         },
218                         // ie9, ie8, and ie7 are not loading the test page
219                         sauce4: {
220                                 port: 3000,
221                                 browsers: [
222                                         'ie9',
223                                         'ie8',
224                                         'ie7'
225                                 ]
226                         },
228                         // ie6 is not loading the test page
229                         // sauce5: {
230                         //  port: 9876,
231                         //  browsers: [
232                         //      'ie6',
233                         //      'iphone_7',
234                         //      'iphone_6_1',
235                         //  ]
236                         // },
238                         // sauce6: {
239                         //  port: 9805,
240                         //  browsers: [
241                         //      'iphone_6'
242                         //  ]
243                         // },
245                         dev: {
246                                 singleRun: false,
247                                 browsers: ['PhantomJS'],
248                                 reporters: 'dots'
249                         }
251                 },
253                 'clean': {
254                         all: {
255                                 src: 'mootools-*.js'
256                         }
257                 }
259         });
261         grunt.registerTask('default', ['clean', 'packager:all', 'packager:specs', 'karma:continuous']);
262         grunt.registerTask('nocompat', ['clean', 'packager:nocompat', 'packager:specs-nocompat', 'karma:continuous']);
263         grunt.registerTask('default:travis', [
264                 'clean',
265                 'packager:all',
266                 'packager:specs',
267                 'karma:sauce1',
268                 'karma:sauce2',
269                 'karma:sauce3',
270                 'karma:sauce4'
271                 // 'karma:sauce5',
272                 // 'karma:sauce6'
273         ])