-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
32 lines (31 loc) · 820 Bytes
/
server.js
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 cp = require('child_process');
const app = require('the-internet-express');
let server = app.listen(3001, async () => {
let specs = process.env.npm_config_spec || 'specs';
let run = () =>
new Promise((resolve, reject) => {
let p = cp.exec(`gauge run ${specs} -v --tags=done --simple-console`, error => {
if (error) {
reject(error);
}
resolve();
});
p.stdout.pipe(process.stdout);
p.stderr.pipe(process.stderr);
});
var failed = false;
try {
await run();
} catch (e) {
console.error(e);
failed = true;
}
console.log('Shutting down the Internet Express');
server.close(e => {
if (e) {
console.error('Failed to close the Internet Express', e);
failed = true;
}
});
if (failed) process.exit(1);
});