mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
a2e44d9773
This commit updates benchpress to include the text representation of results in the JSON report. This is useful when results of multiple tests are read from the Bazel testlogs and then printed together in e.g. a GitHub comment, or at the end of a script (not in the middle of the surroundings of the Bazel executions). The text representation could have been built directly based on the JSON raw metrics, but it would be unnecessary work and duplication to get a similar output as with the console reporter- so we can just include this information in the report. PR Close #50745
31 lines
780 B
TypeScript
31 lines
780 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
|
|
/**
|
|
* SampleDescription merges all available descriptions about a sample
|
|
*/
|
|
export class SampleDescription {
|
|
description: {[key: string]: any};
|
|
|
|
constructor(
|
|
public id: string, descriptions: Array<{[key: string]: any}>,
|
|
public metrics: {[key: string]: any}) {
|
|
this.description = {};
|
|
descriptions.forEach(description => {
|
|
Object.keys(description).forEach(prop => {
|
|
this.description[prop] = description[prop];
|
|
});
|
|
});
|
|
}
|
|
|
|
toJson() {
|
|
return {'id': this.id, 'description': this.description, 'metrics': this.metrics};
|
|
}
|
|
}
|