| 19 | */ |
| 20 | @Injectable() |
| 21 | export class ConsoleReporter extends Reporter { |
| 22 | static PRINT = new InjectionToken('ConsoleReporter.print'); |
| 23 | static PROVIDERS = [ |
| 24 | {provide: ConsoleReporter, deps: [COLUMN_WIDTH, SampleDescription, ConsoleReporter.PRINT]}, |
| 25 | {provide: COLUMN_WIDTH, useValue: defaultColumnWidth}, |
| 26 | { |
| 27 | provide: ConsoleReporter.PRINT, |
| 28 | useValue: function (v: any) { |
| 29 | // tslint:disable-next-line:no-console |
| 30 | console.log(v); |
| 31 | }, |
| 32 | }, |
| 33 | ]; |
| 34 | |
| 35 | private textReporter: TextReporterBase; |
| 36 | |
| 37 | constructor( |
| 38 | @Inject(COLUMN_WIDTH) private _columnWidth: number, |
| 39 | private _sampleDescription: SampleDescription, |
| 40 | @Inject(ConsoleReporter.PRINT) private _print: Function, |
| 41 | ) { |
| 42 | super(); |
| 43 | this.textReporter = new TextReporterBase(this._columnWidth, this._sampleDescription); |
| 44 | this._print(this.textReporter.description()); |
| 45 | } |
| 46 | |
| 47 | override reportMeasureValues(measureValues: MeasureValues): Promise<any> { |
| 48 | this._print(this.textReporter.sampleMetrics(measureValues)); |
| 49 | return Promise.resolve(null); |
| 50 | } |
| 51 | |
| 52 | override reportSample( |
| 53 | _completeSample: MeasureValues[], |
| 54 | validSamples: MeasureValues[], |
| 55 | ): Promise<any> { |
| 56 | this._print(this.textReporter.separator()); |
| 57 | this._print(this.textReporter.sampleStats(validSamples)); |
| 58 | return Promise.resolve(null); |
| 59 | } |
| 60 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…