forked from BlessCSS/bless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-tests
executable file
·32 lines (27 loc) · 893 Bytes
/
run-tests
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
#!/usr/bin/env babel-node
/* eslint no-process-exit: 0 */
import 'colors';
import { exec, spawn } from 'child-process-promise';
const isCI = process.env.CONTINUOUS_INTEGRATION === 'true';
function myspawn(command) {
console.log(`> ${command}\n`);
let [cmd, ...args] = command.split(' ');
return spawn(cmd, args, {stdio: 'inherit'})
.then(() => console.log(''));
}
myspawn('npm run lint')
.then(() => myspawn('mocha --compilers js:babel/register'))
.then(() => {
console.log('Gathering Code Coverage...\n'.cyan);
return exec('rm -rf ./.coverage');
})
.then(() => myspawn('babel-node node_modules/.bin/isparta cover node_modules/.bin/_mocha -- --reporter dot'))
.then(() => {
if (isCI) {
return exec(`cat ./.coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js`);
}
})
.catch(err => {
console.log(err);
process.exit(1);
});