Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use .zuulrc credentials for Sauce Labs tests #619

Merged
merged 6 commits into from Feb 19, 2016
@@ -1,2 +1,3 @@
node_modules
webtorrent.debug.js
.zuulrc
@@ -1,20 +1,30 @@
#!/usr/bin/env node

var spawn = require('cross-spawn-async')
var findNearestFile = require('find-nearest-file')
var path = require('path')
var userHome = require('user-home')
var pathExists = require('path-exists')

var runSauceLabs = process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY
// .zuulrc logic from https://github.com/defunctzombie/zuul/blob/a0de46a5906c84b19f655c487f7c8debe938984d/bin/zuul#L384
var zuulrcPath = findNearestFile('.zuulrc') || path.join(userHome, '.zuulrc')
var hasSauceLabEnvVars = process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY
var runSauceLabs = hasSauceLabEnvVars || pathExists.sync(zuulrcPath)

npmRun('test-node', function (code) {
if (code === 0) {
var scriptName = runSauceLabs ? 'test-browser' : 'test-browser-headless'
npmRun(scriptName, function (code) {
process.exit(code)
})
} else {
process.exit(code)
}
npmRun('test-node', function () {
npmRun('test-browser-headless', function () {
if (runSauceLabs) {
npmRun('test-browser')
}
})
})

function npmRun (scriptName, onClose) {
spawn('npm', ['run', scriptName], { stdio: 'inherit' }).on('close', onClose)
function npmRun (scriptName, onSuccess) {
spawn('npm', ['run', scriptName], { stdio: 'inherit' }).on('close', function (code) {
if (code === 0 && onSuccess) {
onSuccess(code)
} else {
process.exit(code)
}
})
}
@@ -83,12 +83,15 @@
"cross-spawn-async": "^2.0.0",
"electron-prebuilt": "^0.36.7",
"finalhandler": "^0.4.0",
"find-nearest-file": "^1.0.0",
"path-exists": "^2.1.0",
"run-series": "^1.0.2",
"serve-static": "^1.9.3",
"simple-get": "^2.0.0",
"standard": "^6.0.1",
"tape": "^4.0.0",
"uglify-js": "^2.4.15",
"user-home": "^2.0.0",
"zuul": "^3.0.0"
},
"homepage": "https://webtorrent.io",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.