git-off

git off handles large files in git repos
git clone https://noulin.net/git/git-off.git
Log | Files | Refs | README

test.js (1126B)


      1 #!/usr/bin/env node
      2 
      3 var cp = require('child_process')
      4 var fs = require('fs')
      5 var path = require('path')
      6 
      7 var shouldRunBrowserTests = !process.env.TRAVIS_PULL_REQUEST ||
      8   process.env.TRAVIS_PULL_REQUEST === 'false'
      9 
     10 var node = cp.spawn('npm', ['run', 'test-node'], { stdio: 'inherit' })
     11 node.on('close', function (code) {
     12   if (code === 0 && shouldRunBrowserTests) {
     13     runBrowserTests()
     14   } else {
     15     process.exit(code)
     16   }
     17 })
     18 
     19 function 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