Last active
February 4, 2016 22:31
-
-
Save mrsimonemms/8e28e9fea81835fad6bf to your computer and use it in GitHub Desktop.
Sauce Labs setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var browserList = require("./saucelabs_browsers"); | |
module.exports = function (grunt) { | |
/* Load all grunt tasks */ | |
require("load-grunt-tasks")(grunt); | |
require("grunt-timer").init(grunt); | |
var customLaunchers = browserList(); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON("package.json"), | |
karma: { | |
options: { | |
configFile: "./karma.conf.js" | |
}, | |
ci: { | |
browsers: Object.keys(customLaunchers), | |
captureTimeout: 120000, | |
customLaunchers: customLaunchers, | |
reporters: [ | |
"mocha", | |
"saucelabs" | |
], | |
transports: [ | |
"jsonp-polling" | |
], | |
sauceLabs: { | |
accessKey: "<%= pkg.sauceLabs.accessKey %>", | |
build: process.env.BUILD_NUMBER || "local-" + new Date().getTime(), | |
testName: "<%= pkg.name %> unit tests", | |
username: "<%= pkg.sauceLabs.username %>" | |
} | |
} | |
} | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* karma.conf | |
*/ | |
"use strict"; | |
module.exports = function (karma) { | |
var config = { | |
basePath: "", | |
browsers: [ | |
"PhantomJS" | |
], | |
colors: true, | |
files: [ | |
"test/unit/test-config.js", | |
{ | |
pattern: "components/**/*.js", | |
included: false | |
}, | |
{ | |
pattern: "src/**/*.js", | |
included: false | |
}, | |
{ | |
pattern: "test/**/*.test.js", | |
included: false | |
} | |
], | |
frameworks: [ | |
"requirejs", | |
"jasmine" | |
], | |
reporters: [ | |
"mocha" | |
], | |
singleRun: true | |
}; | |
return karma.set(config); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"devDependencies": { | |
"almond": "^0.3.1", | |
"grunt": "^0.4.5", | |
"grunt-contrib-clean": "^0.6.0", | |
"grunt-contrib-jshint": "^0.11.2", | |
"grunt-contrib-requirejs": "^0.4.4", | |
"grunt-contrib-uglify": "^0.9.1", | |
"grunt-contrib-watch": "^0.6.1", | |
"grunt-jscs": "^2.0.0", | |
"grunt-jsonlint": "^1.0.4", | |
"grunt-karma": "^0.11.0", | |
"grunt-timer": "^0.6.0", | |
"grunt-umd": "^2.3.3", | |
"jasmine-core": "^2.3.4", | |
"karma": "^0.12.8", | |
"karma-chrome-launcher": "^0.2.0", | |
"karma-coverage": "^0.5.0", | |
"karma-firefox-launcher": "^0.1.6", | |
"karma-jasmine": "^0.3.0", | |
"karma-mocha-reporter": "^1.1.0", | |
"karma-phantomjs-launcher": "^0.2.1", | |
"karma-requirejs": "^0.2.2", | |
"karma-sauce-launcher": "^0.2.14", | |
"load-grunt-tasks": "^3.2.0", | |
"lodash": "^3.10.1", | |
"phantomjs": "^1.9.17", | |
"requirejs": "^2.1.20", | |
"semver": "^5.0.1" | |
}, | |
"sauceLabs": { | |
"accessKey": "xxxx", | |
"username": "xxxx" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* saucelabs_browsers | |
*/ | |
"use strict"; | |
/* Node modules */ | |
/* Third-party modules */ | |
var _ = require("lodash"); | |
/* Files */ | |
var browsers = { | |
"internet explorer": [ | |
"11", | |
"10", | |
"9", | |
"8", | |
"7", | |
"6" | |
], | |
firefox: [ | |
"dev", | |
"beta", | |
null, | |
"3.6" | |
], | |
chrome: [ | |
"dev", | |
"beta", | |
null, | |
"26" | |
], | |
safari: [ | |
"8.0", | |
"7.0", | |
"6.0" | |
], | |
opera: [ | |
"12.15", | |
"11.64" | |
] | |
}; | |
module.exports = function () { | |
return _.reduce(browsers, function (result, versions, browser) { | |
_.each(versions, function (version) { | |
var platform = null; | |
var ver = null; | |
if (_.isObject(version)) { | |
/* Platform specified */ | |
platform = version.platform || null; | |
ver = version.version || null; | |
} else if (version) { | |
/* Version only set */ | |
ver = version; | |
} | |
var name = [ | |
"SL", browser | |
]; | |
if (ver === null) { | |
name.push("current"); | |
} else { | |
name.push(ver); | |
} | |
if (platform) { | |
name.push(platform); | |
} | |
name = name.join("_").replace(/\s/g, "_"); | |
var obj = { | |
base: "SauceLabs", | |
browserName: browser | |
}; | |
if (platform) { | |
obj.platform = platform | |
} | |
if (ver) { | |
obj.version = ver; | |
} | |
result[name] = obj; | |
}); | |
return result; | |
}, {}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment