Created
April 9, 2014 16:05
-
-
Save bclinkinbeard/10286872 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spawn = require('child_process').spawn, | |
path = require('path'), | |
http = require('http'), | |
st = require('st'), | |
colors = require('colors'), | |
watchify = require('watchify'), | |
writer = require('write-to-path'), | |
gaze = require('gaze'); | |
var entry = './example/index.js', | |
bundle = './example/bundle.js', | |
tests = './test/e2e/**/*.spec.js', // TODO: read from specs in conf | |
pConf = './test/e2e/protractor.conf.js', | |
debug = true, | |
cb = writer(path.resolve(process.cwd(), bundle), {debug: debug}), | |
w = watchify().add(path.resolve(process.cwd(), entry)); | |
// start server | |
http.createServer(st(process.cwd())).listen(8000); // TODO: read port from baseUrl in conf | |
// run when bundle or tests change | |
w.on('update', bundleAndTest); | |
gaze(tests, function () { this.on('all', bundleAndTest); }) | |
// run on start | |
bundleAndTest(); | |
function bundleAndTest () { | |
console.log('\n%s'.cyan, new Date(Date.now())); | |
w.bundle({debug: debug}, cb); | |
spawn('./node_modules/.bin/protractor', [pConf], { stdio: 'inherit' }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment