Skip to content
This repository was archived by the owner on Apr 1, 2019. It is now read-only.

Commit 464b913

Browse files
committed
improve test log
1 parent fa2a8f5 commit 464b913

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const commands = [
1111
{cmd: 'npm', args: ['run', 'test:cov'], cwd: 'test-cmp'}
1212
];
1313

14-
function executeCommand(command) {
14+
function executeCommand(command, index) {
1515
return new Promise((resolve, reject) => {
1616
let cp = spawn(command.cmd, command.args, {cwd: command.cwd});
1717
process.on('exit', cp.kill);
@@ -44,16 +44,23 @@ function executeCommand(command) {
4444
reject(code);
4545
rejected = true;
4646
} else {
47-
console.log('process exit with status', code);
47+
console.log(
48+
'=> process',
49+
(index+1),
50+
'of',
51+
commands.length,
52+
'exit with status',
53+
code
54+
);
4855
resolve(code);
4956
}
5057
});
5158
});
5259
}
5360

54-
commands.reduce((prev, next) => {
61+
commands.reduce((prev, next, index) => {
5562
return prev.then(() => {
56-
return executeCommand(next)
63+
return executeCommand(next, index)
5764
.catch(code => {
5865
console.log('child process exit with', code);
5966
if (!next.ignoreErrors) process.exit(code);

0 commit comments

Comments
 (0)