зеркало из https://github.com/microsoft/just.git
make sure to display errors and tasks that are skipped by catching it
This commit is contained in:
Родитель
ed8816e3b5
Коммит
2ebdffd6c9
|
@ -61,16 +61,28 @@ undertaker.on('error', function(args: any) {
|
|||
logger.error(chalk.yellow('------------------------------------'));
|
||||
process.exitCode = 1;
|
||||
} else if (shouldLog(args)) {
|
||||
const duration = args.duration;
|
||||
const durationInSecs = Math.round(((duration[0] * NS_PER_SEC + duration[1]) / NS_PER_SEC) * 100) / 100;
|
||||
logger.error(`finished '${colorizeTaskName(args.name)}' in ${chalk.yellow(String(durationInSecs) + 's')} with ${chalk.red('errors')}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
if (topLevelTask === args.name) {
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
process.on('exit', code => {
|
||||
if (code !== 0) {
|
||||
logger.error(chalk.dim(`Error previously detected. See above for error messages.`));
|
||||
}
|
||||
|
||||
if (topLevelTask === args.name && Object.keys(tasksInProgress).length > 0) {
|
||||
if (Object.keys(tasksInProgress).length > 0) {
|
||||
logger.error(
|
||||
`Other tasks that did not complete: [${Object.keys(tasksInProgress)
|
||||
.map(taskName => colorizeTaskName(taskName))
|
||||
.join(', ')}]`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -8,19 +8,13 @@ export function wrapTask(fn: any) {
|
|||
if (origFn.length > 0) {
|
||||
(fn as any).call(null, done);
|
||||
} else {
|
||||
let results = (fn as any).call();
|
||||
let results = (origFn as any).call();
|
||||
|
||||
// The result is a function, we will assume that this is a task function to be called
|
||||
if (results && typeof results === 'function') {
|
||||
return results.call(null, done);
|
||||
} else if (results && results.then) {
|
||||
return results
|
||||
.then(() => {
|
||||
done();
|
||||
})
|
||||
.catch((e: any) => {
|
||||
done(e);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
|
||||
done();
|
||||
|
|
Загрузка…
Ссылка в новой задаче