( definition: ScenarioDefinition, commandOrName: string, )
| 22 | * exist or be produced via `--prepare`. |
| 23 | */ |
| 24 | export function resolveCommand( |
| 25 | definition: ScenarioDefinition, |
| 26 | commandOrName: string, |
| 27 | ): ResolvedCommand { |
| 28 | const commands = definition.benchmark?.commands ?? {}; |
| 29 | |
| 30 | for (const [name, config] of Object.entries(commands)) { |
| 31 | if ("steps" in config) { |
| 32 | for (const [stepName, step] of Object.entries(config.steps)) { |
| 33 | if (stepName === commandOrName) { |
| 34 | return { command: step.command, resolvedFrom: stepName }; |
| 35 | } |
| 36 | } |
| 37 | } else if (name === commandOrName) { |
| 38 | return { command: config.command, resolvedFrom: name }; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | return { command: commandOrName, resolvedFrom: undefined }; |
| 43 | } |
no outgoing calls
no test coverage detected