@boost/core
Version:
Robust pipeline for creating dev tools that separate logic into routines and tasks.
53 lines (52 loc) • 1.86 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Reporter_1 = __importDefault(require("../Reporter"));
class CIReporter extends Reporter_1.default {
constructor() {
super(...arguments);
this.routineCount = 0;
this.taskCount = 0;
this.handleRoutine = (routine) => {
this.routineCount += 1;
this.console.out('.');
routine.onFail.listen(this.handleRoutineFail);
routine.onPass.listen(this.handleRoutinePass);
routine.onSkip.listen(this.handleRoutineSkip);
};
this.handleRoutineSkip = () => {
this.console.out(this.style('.', 'warning'));
};
this.handleRoutinePass = () => {
this.console.out(this.style('.', 'success'));
};
this.handleRoutineFail = () => {
this.console.err(this.style('.', 'failure'));
};
this.handleTask = () => {
this.taskCount += 1;
this.console.out(this.style('.', 'pending'));
};
this.handleStop = () => {
const msg = this.tool.msg('app:ciRanIn', {
routineCount: this.routineCount,
taskCount: this.taskCount,
time: this.getElapsedTime(this.startTime, this.stopTime, false),
});
this.console.out(`\n${msg}\n`);
};
}
blueprint() {
return {};
}
bootstrap() {
super.bootstrap();
this.console.disable();
this.console.onStop.listen(this.handleStop);
this.console.onRoutine.listen(this.handleRoutine);
this.console.onTask.listen(this.handleTask);
}
}
exports.default = CIReporter;