@@ -6,7 +6,9 @@ export default class BenchmarkSpec {
66 /**
77 * @param {object } config - The benchmark configuration object
88 * @param {string } config.command - The UI5 CLI command to benchmark (e.g., "build")
9+ * @param {string } [config.env] - Optional environment variables to prefix the command with
910 * @param {string } [config.prepare] - Optional shell command to run before each benchmark
11+ * @param {string } [config.conclude] - Optional shell command to run after each benchmark
1012 * @param {object } config.groups - Map of group keys to group-specific config
1113 * @param {string } config.groups[].name - Display name for this benchmark in the group
1214 * @param {string[] } [config.revisions] - Optional list of revision keys this benchmark should run on
@@ -19,9 +21,15 @@ export default class BenchmarkSpec {
1921 if ( ! config . command || typeof config . command !== "string" ) {
2022 throw new Error ( "Benchmark must have a command string" ) ;
2123 }
24+ if ( config . env !== undefined && typeof config . env !== "string" ) {
25+ throw new Error ( "Benchmark env must be a string if provided" ) ;
26+ }
2227 if ( config . prepare !== undefined && typeof config . prepare !== "string" ) {
2328 throw new Error ( "Benchmark prepare must be a string if provided" ) ;
2429 }
30+ if ( config . conclude !== undefined && typeof config . conclude !== "string" ) {
31+ throw new Error ( "Benchmark conclude must be a string if provided" ) ;
32+ }
2533 if ( ! config . groups || typeof config . groups !== "object" || Object . keys ( config . groups ) . length === 0 ) {
2634 throw new Error ( "Benchmark must belong to at least one group" ) ;
2735 }
@@ -53,14 +61,18 @@ export default class BenchmarkSpec {
5361
5462 this . #index = index ;
5563 this . #command = config . command ;
64+ this . #env = config . env || null ;
5665 this . #prepare = config . prepare || null ;
66+ this . #conclude = config . conclude || null ;
5767 this . #groupMemberships = new Map ( Object . entries ( config . groups ) ) ;
5868 this . #revisionKeys = config . revisions ? [ ...config . revisions ] : null ;
5969 }
6070
6171 #index;
6272 #command;
73+ #env;
6374 #prepare;
75+ #conclude;
6476 #groupMemberships; // Map<groupKey, {name: displayName}>
6577 #revisionKeys; // null means all revisions, otherwise array of revision keys
6678
@@ -72,10 +84,18 @@ export default class BenchmarkSpec {
7284 return this . #command;
7385 }
7486
87+ get env ( ) {
88+ return this . #env;
89+ }
90+
7591 get prepare ( ) {
7692 return this . #prepare;
7793 }
7894
95+ get conclude ( ) {
96+ return this . #conclude;
97+ }
98+
7999 get groupMemberships ( ) {
80100 return new Map ( this . #groupMemberships) ;
81101 }
0 commit comments