UNPKG

1.13 kBJavaScriptView Raw
1#!/usr/bin/env node
2
3var cp = require('child_process')
4var fs = require('fs')
5var path = require('path')
6
7var shouldRunBrowserTests = !process.env.TRAVIS_PULL_REQUEST ||
8 process.env.TRAVIS_PULL_REQUEST === 'false'
9
10var node = cp.spawn('npm', ['run', 'test-node'], { stdio: 'inherit' })
11node.on('close', function (code) {
12 if (code === 0 && shouldRunBrowserTests) {
13 runBrowserTests()
14 } else {
15 process.exit(code)
16 }
17})
18
19function runBrowserTests () {
20 var zuulYmlPath = path.join(__dirname, '..', '.zuul.yml')
21
22 writeES5ZuulYml()
23 cp.spawn('npm', ['run', 'test-browser-es5'], { stdio: 'inherit' })
24 .on('close', function (code) {
25 if (code !== 0) process.exit(code)
26 writeES6ZuulYml()
27 cp.spawn('npm', ['run', 'test-browser-es6'], { stdio: 'inherit' })
28 .on('close', function (code) {
29 process.exit(code)
30 })
31 })
32
33 function writeES5ZuulYml () {
34 fs.writeFileSync(zuulYmlPath, fs.readFileSync(path.join(__dirname, 'zuul-es5.yml')))
35 }
36
37 function writeES6ZuulYml () {
38 fs.writeFileSync(zuulYmlPath, fs.readFileSync(path.join(__dirname, 'zuul-es6.yml')))
39 }
40}
41