diff --git a/.gitignore b/.gitignore index d72414099..be8157c49 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ node_modules mootools-all.js mootools-nocompat.js mootools-specs.js +sauce*.log \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 20fd86b6a..4a8380679 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,15 @@ language: node_js + node_js: - - 0.10 +- 0.11 + +env: + global: + - secure: hxXNl/FkYm4lukIM+drQ4qXe6swmVyUvZRFhUCnMUZBTGsEHjySq/S1Z7KH69/3I+ULqERMeFo/Hsuw3fmZqtGwbFS+XyPm2ulCdhRy/ypCupSeTx/DbHV5Aej4QeGKb5J0N1jEEowMs5zTjpCoyNiSW/oFP/xS5tiuwUOvL+AQ= + - secure: DdWSqy6Qzbnl3bTUIk+2oTEOghakK/UxtGow3ZUbzLxX9Lu924ve/7d+BQbJl+QsTqt+PYMPdpg6n7Y6oqOop6sAIRECPx/7lMx57whd0XHRXpLPbs2abXkFdG6w1x0ybm+6G2CiWUQ1BnmI1MqlkMmikK+X4jWgyJ7s1qYk4Us= + +before_script: + - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash + +script: + - grunt default:travis \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 61ea8f4cc..e324ebf10 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,12 +1,34 @@ "use strict"; -module.exports = function(grunt){ +module.exports = function(grunt) { - grunt.loadNpmTasks('grunt-mootools-packager'); - grunt.loadNpmTasks('grunt-karma'); - grunt.loadNpmTasks('grunt-contrib-clean'); + require('load-grunt-tasks')(grunt); grunt.initConfig({ + 'connect': { + testserver: { + options: { + // We use end2end task (which does not start the webserver) + // and start the webserver as a separate process + // to avoid https://github.com/joyent/libuv/issues/826 + port: 8000, + hostname: '0.0.0.0', + middleware: function(connect, options) { + return [ + function(req, resp, next) { + // cache get requests to speed up tests on travis + if (req.method === 'GET') { + resp.setHeader('Cache-control', 'public, max-age=3600'); + } + + next(); + }, + connect.static(options.base) + ]; + } + } + } + }, 'packager': { @@ -51,16 +73,181 @@ module.exports = function(grunt){ 'karma': { options: { - browsers: ['PhantomJS'], + captureTimeout: 60000 * 2, + singleRun: true, frameworks: ['jasmine', 'sinon'], - files: ['http://rawgithub.com/bitovi/legacy-syn/master/dist/syn.js', 'mootools-*.js'] + files: [ + 'http://rawgithub.com/bitovi/legacy-syn/master/dist/syn.js', + 'mootools-*.js' + ], + sauceLabs: { + username: process.env.SAUCE_USERNAME, + accessKey: process.env.SAUCE_ACCESS_KEY, + testName: 'MooTools-Core' + }, + customLaunchers: { + chrome_linux: { + base: 'SauceLabs', + browserName: 'chrome', + platform: 'linux' + }, + firefox_linux: { + base: 'SauceLabs', + browserName: 'firefox', + platform: 'linux' + }, + opera_win2000: { + base: 'SauceLabs', + browserName: 'opera', + platform: 'Windows 2008', + version: '12' + }, + safari7: { + base: 'SauceLabs', + browserName: 'safari', + platform: 'OS X 10.9', + version: '7' + }, + safari6: { + base: 'SauceLabs', + browserName: 'safari', + platform: 'OS X 10.8', + version: '6' + }, + safari5_osx10_6: { + base: 'SauceLabs', + browserName: 'safari', + version: '5', + platform: 'OS X 10.6' + }, + safari5_win7: { + base: 'SauceLabs', + browserName: 'safari', + version: '5', + platform: 'Windows 7' + }, + ie11: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 8.1', + version: '11' + }, + ie10: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 8', + version: '10' + }, + ie9: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 7', + version: '9' + }, + ie8: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 7', + version: '8' + }, + ie7: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows XP', + version: '7' + }, + ie6: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows XP', + version: '6' + }, + iphone_7: { + base: 'SauceLabs', + browserName: 'iphone', + platform: 'OS X 10.9', + version: '7', + deviceOrientation: 'portrait' + }, + iphone_6_1: { + base: 'SauceLabs', + browserName: 'iphone', + platform: 'OS X 10.8', + version: '6.1', + deviceOrientation: 'portrait' + }, + iphone_6: { + base: 'SauceLabs', + browserName: 'iphone', + platform: 'OS X 10.8', + version: '6', + deviceOrientation: 'portrait' + } + }, }, continuous: { - singleRun: true + browsers: ['PhantomJS'] + }, + + sauce1: { + port: 9876, + browsers: [ + 'chrome_linux', + 'firefox_linux', + 'opera_win2000' + ] }, + sauce2: { + port: 9877, + browsers: [ + 'safari7', + 'safari6', + 'safari5_osx10_6' + ], + }, + + // safari5_win7, ie11 and ie10 are not loading the test page + sauce3: { + port: 9999, + browsers: [ + 'safari5_win7', + 'ie11', + 'ie10' + ] + }, + + // ie9, ie8, and ie7 are not loading the test page + sauce4: { + port: 3000, + browsers: [ + 'ie9', + 'ie8', + 'ie7' + ] + }, + + // ie6 is not loading the test page + // sauce5: { + // port: 9876, + // browsers: [ + // 'ie6', + // 'iphone_7', + // 'iphone_6_1', + // ] + // }, + + // sauce6: { + // port: 9805, + // browsers: [ + // 'iphone_6' + // ] + // }, + dev: { + singleRun: false, + browsers: ['PhantomJS'], reporters: 'dots' } @@ -75,5 +262,16 @@ module.exports = function(grunt){ }); grunt.registerTask('default', ['clean', 'packager:all', 'packager:specs', 'karma:continuous']); - grunt.registerTask('nocompat', ['clean', 'packager:nocompat', 'packager:specs-nocompat', 'karma:continuous']) -}; + grunt.registerTask('nocompat', ['clean', 'packager:nocompat', 'packager:specs-nocompat', 'karma:continuous']); + grunt.registerTask('default:travis', [ + 'clean', + 'packager:all', + 'packager:specs', + 'karma:sauce1', + 'karma:sauce2', + 'karma:sauce3', + 'karma:sauce4' + // 'karma:sauce5', + // 'karma:sauce6' + ]) +}; \ No newline at end of file diff --git a/package.json b/package.json index 2119193cf..fe1fc6e87 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "MooTools is a compact, modular, Object-Oriented JavaScript framework designed for the intermediate to advanced JavaScript developer.", "main": "index.js", "scripts": { - "test": "grunt test -v" + "test": "./node_modules/.bin/grunt --verbose" }, "repository": { "type": "git", @@ -30,9 +30,14 @@ "devDependencies": { "grunt": "~0.4.2", "grunt-mootools-packager": "^0.1.2", - "grunt-karma": "^0.6.2", - "karma-jasmine": "^0.1.5", "grunt-contrib-clean": "~0.5.0", - "karma-sinon": "~1.0.2" + "grunt-contrib-connect": "~0.7.0", + "load-grunt-tasks": "~0.4.0", + "grunt-cli": "~0.1.13", + "karma": "~0.11.14", + "grunt-karma": "~0.7.2", + "karma-jasmine": "~0.1.5", + "karma-sinon": "~1.0.2", + "karma-sauce-launcher": "~0.2.0" } }