-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserve.js
More file actions
33 lines (27 loc) · 764 Bytes
/
serve.js
File metadata and controls
33 lines (27 loc) · 764 Bytes
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
const spawn = require('child_process').spawn;
const selenium = require('./selenium');
const execPolyServe = (config) => {
return new Promise((resolve, reject) => {
console.log('Serving the components');
const server = spawn('polymer', [
`serve`,
`--root ${config.root}`,
`--open-path ${config.root}/__benchmark_runner.html`,
`--sources __benchmark_harness.html`,
'-H 0.0.0.0'
]);
server.stdout.on('data', data => {
if(data.toString().split('applications: ')[1]){
config.served = data.toString().split('applications: ')[1].trim().split('\n')[0];
return resolve(selenium(config, server.pid))
}
});
})
};
const killPid = pid => {
process.kill(-pid);
};
module.exports = {
start: execPolyServe,
stop: killPid
};