Skip to content

Commit

Permalink
npm test uses Electron if saucelabs cannot be used
Browse files Browse the repository at this point in the history
  • Loading branch information
josephfrazier committed Feb 9, 2016
1 parent fc5aaa6 commit d5aa948
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bin/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ var spawn = require('cross-spawn-async')
var runBrowserTests = process.env.TRAVIS && (!process.env.TRAVIS_PULL_REQUEST ||
process.env.TRAVIS_PULL_REQUEST === 'false')

var node = spawn('npm', ['run', 'test-node'], { stdio: 'inherit' })
node.on('close', function (code) {
if (code === 0 && runBrowserTests) {
var browser = spawn('npm', ['run', 'test-browser'], { stdio: 'inherit' })
browser.on('close', function (code) {
npmRun('test-node', function (code) {
if (code === 0) {
var scriptName = runBrowserTests ? 'test-browser' : 'test-browser-headless'
npmRun(scriptName, function (code) {
process.exit(code)
})
} else {
process.exit(code)
}
})

function npmRun (scriptName, onClose) {
spawn('npm', ['run', scriptName], { stdio: 'inherit' }).on('close', onClose)
}

0 comments on commit d5aa948

Please sign in to comment.