3 var fs = require('fs');
4 var path = require('path');
5 var YAML = require('js-yaml');
6 var ymlPackage = YAML.safeLoad(fs.readFileSync('package.yml', 'utf8'));
7 var travisBuild = process.env.BUILD;
8 var travisBrowser = process.env.BROWSER;
9 var sauceBrowsers = JSON.parse(fs.readFileSync('Tests/browsers.json'));
10 var serverBuildOptions = JSON.parse(fs.readFileSync('Tests/dist-tasks.json')).build.server.options;
12 modules: serverBuildOptions.only,
13 specFiles: ['Specs/Core/*.js', 'Specs/Class/*.js', 'Specs/Types/*.js', 'Specs/Utilities/JSON.js'],
14 strip: serverBuildOptions.strip
17 var packagerOptions = {
20 src: ymlPackage.sources,
21 dest: 'mootools-all.js'
26 only: '<%= grunt.option("file") && "Core/" + grunt.option("file") %>'
28 src: ymlPackage.sources,
29 dest: 'mootools-nocompat.js'
33 strip: serverBuild.strip,
34 only: serverBuild.modules
36 src: ymlPackage.sources,
37 dest: 'mootools-server.js'
43 src: 'Specs/<%= grunt.option("module") || "**" %>/<%= grunt.option("file") || "*" %>.js',
44 dest: 'mootools-specs.js'
50 only: '<%= grunt.option("file") && "Specs/" + grunt.option("file") %>'
53 dest: 'mootools-specs.js'
58 strip: serverBuild.strip,
60 src: serverBuild.specFiles,
61 dest: 'mootools-server-specs.js'
68 // We use end2end task (which does not start the webserver)
69 // and start the webserver as a separate process
70 // to avoid https://github.com/joyent/libuv/issues/826
73 middleware: function(connect, options){
75 function(req, resp, next){
76 // cache get requests to speed up tests on travis
77 if (req.method === 'GET'){
78 resp.setHeader('Cache-control', 'public, max-age=3600');
82 connect.static(options.base)];
89 captureTimeout: 60000 * 2,
91 frameworks: ['chai', 'jasmine', 'sinon', 'syn'],
92 plugins: ['karma-*', path.resolve('Tests/Plugins/syn')],
93 files: ['mootools-*.js'],
95 username: process.env.SAUCE_USERNAME,
96 accessKey: process.env.SAUCE_ACCESS_KEY,
97 testName: 'MooTools-Core. Build: ' + travisBuild + '. Browser: ' + travisBrowser
99 reporters: ['progress', 'saucelabs'],
100 customLaunchers: sauceBrowsers,
103 var travisOptions = {
105 browser: travisBrowser
108 exports.packager = packagerOptions;
109 exports.grunt = gruntOptions;
110 exports.karma = karmaOptions;
111 exports.travis = travisOptions;