-
Notifications
You must be signed in to change notification settings - Fork 0
/
coverage.js
28 lines (26 loc) · 930 Bytes
/
coverage.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
const path = require('path');
const spawn = require('child_process').spawn;
const log = d => process.stdout.write(d);
const cwd = path.normalize(__dirname + '/../../');
const argument = require('ezzy-argument');
const suite = argument('suite', 'all');
let bat;
bat = spawn('/bin/sh', ['-c',
'PORT=9001 HIDE_ARGUMENTS=true ' +
'node ./node_modules/istanbul/lib/cli.js ' +
`cover ./node_modules/ezzy-testing/${suite}.js`
], {cwd, timeout: 900000});
bat.stdout.on('data', log);
bat.stderr.on('data', log);
bat.on('exit', code => {
if (code !== 0) {
return console.log(`Child exited with code ${code}`);
}
bat = spawn('/bin/sh', ['-c',
'PORT=9001 HIDE_ARGUMENTS=true ' +
'cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js'
], {cwd, timeout: 180000});
bat.stdout.on('data', log);
bat.stderr.on('data', log);
bat.on('exit', code => console.log(`Child exited with code ${code}`));
});