diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/test.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/test.js b/bin/test.js index 2755c10..2c874f0 100644 --- a/bin/test.js +++ b/bin/test.js @@ -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) +} |