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

bin/test.js: move process.exit logic into npmRun helper

This helps reduce nesting.
  • Loading branch information
josephfrazier committed Feb 15, 2016
commit a59b4db204a2839f3ff56f9403e98e7981517835
@@ -12,21 +12,21 @@ var hasSauceLabEnvVars = process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_
var runSauceLabs = hasSauceLabEnvVars || pathExists.sync(zuulrcPath)

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

function npmRun (scriptName, onClose) {
spawn('npm', ['run', scriptName], { stdio: 'inherit' }).on('close', onClose)
spawn('npm', ['run', scriptName], { stdio: 'inherit' }).on('close', function (code) {
if (code === 0) {
onClose(code)
} else {
process.exit(code)
}
})
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.