function index(){ const head = is.arr(globals) ? globals.join('\n') : globals , html = file(local(`./client/${runner}/index.html`)) .replace('<!-- { extra scripts } -->', head || '') return (req, res) => res.send(html) }
function reload(uid) { const uids = uid ? [uid] : ripple.server.ws.sockets.map(d => d.platform.uid) uids .map(uid => update(`${uid}.stats.running`, true)(ripple('results'))) const agents = ripple.server.ws.sockets .filter(not(by('handshake.url', '/dashboard'))) .filter(by('platform.uid', is.in(uids))) .map(emitReload) .length log('reloading', str(agents).cyan, 'agents', uid || '') }
function generate() { log('generating tests') const bundle = write(local('./client/tests.js')) , stream = is.fn(tests) ? tests() : run('sh', ['-c', tests], { stdio: 'pipe' }) if (stream.stderr) stream.stderr.pipe(process.stderr) ;((stream.stdout || stream) .on('end', debounce(500)(reload)) .pipe(bundle) .flow || noop)() }
const canonical = farm => browser => is.str(browser) ? farms[farm].browsers[browser] : browser