Skip to content

Commit 259eff8

Browse files
committed
Read saucelabs config from a file
1 parent df63299 commit 259eff8

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"docdash": "^0.4.0",
2424
"filesaver.js": "github:andyinabox/FileSaver.js",
2525
"jasmine": "^2.5.2",
26+
"js-yaml": "^3.6.1",
2627
"jsdoc": "^3.4.1",
2728
"karma-sauce-launcher": "^1.0.0",
2829
"requirejs": "^2.3.2"
@@ -43,7 +44,7 @@
4344
"start": "ws",
4445
"build": "npm install && bower install && node build.js",
4546
"version": "npm run build && git add -A dist",
46-
"test": "./node_modules/.bin/karma start --single-run",
47+
"test": "./node_modules/.bin/karma start saucelabs.karma.conf.js --single-run",
4748
"test-local": "./node_modules/.bin/karma start --single-run",
4849
"generate-docs": "node_modules/.bin/jsdoc -c jsdoc.json"
4950
}

saucelabs.karma.conf.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
'use strict'
2+
const yaml = require('js-yaml')
3+
const fs = require('fs')
4+
15
const browsers = {
26
sl_chrome: {
37
base: 'SauceLabs',
@@ -24,6 +28,8 @@ const browsers = {
2428
}
2529
}
2630

31+
let sauceConfig = yaml.safeLoad(fs.readFileSync('.sauce.yml', 'utf8'))
32+
2733
module.exports = (config) => {
2834
config.set({
2935

@@ -80,6 +86,10 @@ module.exports = (config) => {
8086
// purpose of this blog post.
8187
reporters: ['saucelabs', 'progress'], // 2
8288
browsers: Object.keys(browsers), // 3
83-
customLaunchers: browsers // 4
89+
customLaunchers: browsers, // 4
90+
sauceLabs: {
91+
username: sauceConfig.addons.sauce_connect.username,
92+
access_key: sauceConfig.addons.sauce_connect.access_key
93+
}
8494
})
8595
}

0 commit comments

Comments
 (0)