1 | import os from 'os';
|
2 | import { ProgressKeeper } from './progress-keeper.js';
|
3 | export class ProgressAppendOnlyReporter extends ProgressKeeper {
|
4 | onMutationTestingPlanReady(event) {
|
5 | super.onMutationTestingPlanReady(event);
|
6 | if (event.mutantPlans.length) {
|
7 | this.intervalReference = setInterval(() => this.render(), 10000);
|
8 | }
|
9 | }
|
10 | onAllMutantsTested() {
|
11 | if (this.intervalReference) {
|
12 | clearInterval(this.intervalReference);
|
13 | }
|
14 | }
|
15 | render() {
|
16 | process.stdout.write(`Mutation testing ${this.getPercentDone()} (elapsed: ${this.getElapsedTime()}, remaining: ${this.getEtc()}) ` +
|
17 | `${this.progress.tested}/${this.progress.mutants} tested (${this.progress.survived} survived, ${this.progress.timedOut} timed out)` +
|
18 | os.EOL);
|
19 | }
|
20 | getPercentDone() {
|
21 | return `${Math.floor((this.progress.ticks / this.progress.total) * 100)}%`;
|
22 | }
|
23 | }
|
24 |
|
\ | No newline at end of file |