1- const NODE_OVERHEAD_RESULTS_HEADER = [ 'Scenario' , 'Prev Requests/s' , 'New Requests/s' , 'Change %' ] ;
1+ const NODE_OVERHEAD_RESULTS_HEADER = [ 'Scenario' , 'Requests/s' , '% of Baseline' , 'Prev Requests/s', 'Change %' ] ;
22
33export class Formatter {
44 formatPercentageChange ( base = 0 , current = 0 ) {
@@ -24,8 +24,14 @@ export class Formatter {
2424 return `${ formatted } %` ;
2525 }
2626
27- formatResult ( name , base , current ) {
28- return [ name , base , current , this . formatPercentageChange ( base , current ) ] ;
27+ formatResult ( name , base , current , baseline ) {
28+ return [
29+ name ,
30+ current || '-' ,
31+ baseline != null ? this . formatPercentageChange ( baseline , current ) : '-' ,
32+ base || '-' ,
33+ this . formatPercentageChange ( base , current ) ,
34+ ] ;
2935 }
3036
3137 hasChanges ( base , current , threshold = 0 ) {
@@ -50,11 +56,18 @@ export class Formatter {
5056 formatResults ( base , current ) {
5157 const headers = NODE_OVERHEAD_RESULTS_HEADER ;
5258
59+ const baseline = current ?. baseline ;
60+
5361 return [
5462 headers ,
5563 this . formatResult ( 'Baseline' , base ?. baseline , current ?. baseline ) ,
56- this . formatResult ( 'With Sentry' , base ?. withInstrument , current ?. withInstrument ) ,
57- this . formatResult ( 'With Sentry (error only)' , base ?. withInstrumentErrorOnly , current ?. withInstrumentErrorOnly ) ,
64+ this . formatResult ( 'With Sentry' , base ?. withInstrument , current ?. withInstrument , baseline ) ,
65+ this . formatResult (
66+ 'With Sentry (error only)' ,
67+ base ?. withInstrumentErrorOnly ,
68+ current ?. withInstrumentErrorOnly ,
69+ baseline ,
70+ ) ,
5871 ] ;
5972 }
6073}
0 commit comments