blob: 617fe97a6178af83ca4914b18a84f8d1729b732c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/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')
// .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) {
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', function (code) {
if (code === 0) {
onClose(code)
} else {
process.exit(code)
}
})
}
|