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

Commit

Permalink
improve test log
Browse files Browse the repository at this point in the history
  • Loading branch information
klarkc committed Oct 22, 2017
1 parent fa2a8f5 commit 464b913
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const commands = [
{cmd: 'npm', args: ['run', 'test:cov'], cwd: 'test-cmp'}
];

function executeCommand(command) {
function executeCommand(command, index) {
return new Promise((resolve, reject) => {
let cp = spawn(command.cmd, command.args, {cwd: command.cwd});
process.on('exit', cp.kill);
Expand Down Expand Up @@ -44,16 +44,23 @@ function executeCommand(command) {
reject(code);
rejected = true;
} else {
console.log('process exit with status', code);
console.log(
'=> process',
(index+1),
'of',
commands.length,
'exit with status',
code
);
resolve(code);
}
});
});
}

commands.reduce((prev, next) => {
commands.reduce((prev, next, index) => {
return prev.then(() => {
return executeCommand(next)
return executeCommand(next, index)
.catch(code => {
console.log('child process exit with', code);
if (!next.ignoreErrors) process.exit(code);
Expand Down

0 comments on commit 464b913

Please sign in to comment.