UNPKG

1.44 kBJavaScriptView Raw
1import { progressBarWrapper } from './progress-bar.js';
2import { ProgressKeeper } from './progress-keeper.js';
3export class ProgressBarReporter extends ProgressKeeper {
4 onMutationTestingPlanReady(event) {
5 super.onMutationTestingPlanReady(event);
6 const progressBarContent = 'Mutation testing [:bar] :percent (elapsed: :et, remaining: :etc) :tested/:mutants Mutants tested (:survived survived, :timedOut timed out)';
7 this.progressBar = new progressBarWrapper.ProgressBar(progressBarContent, {
8 complete: '=',
9 incomplete: ' ',
10 stream: process.stdout,
11 total: this.progress.total,
12 width: 50,
13 });
14 }
15 onMutantTested(result) {
16 const ticks = super.onMutantTested(result);
17 const progressBarContent = { ...this.progress, et: this.getElapsedTime(), etc: this.getEtc() };
18 if (ticks) {
19 this.tick(ticks, progressBarContent);
20 }
21 else {
22 this.render(progressBarContent);
23 }
24 return ticks;
25 }
26 tick(ticks, tickObj) {
27 var _a;
28 (_a = this.progressBar) === null || _a === void 0 ? void 0 : _a.tick(ticks, tickObj);
29 }
30 render(renderObj) {
31 var _a;
32 if ((_a = this.progressBar) === null || _a === void 0 ? void 0 : _a.total) {
33 this.progressBar.render(renderObj);
34 }
35 }
36}
37//# sourceMappingURL=progress-reporter.js.map
\No newline at end of file