(prompt: string, placeholders: Readonly<Record<string, string>>)
| 116 | |
| 117 | /** Substitutes `{{NAME}}` placeholders, refusing prompts that need a value the fixture does not provide. */ |
| 118 | export function resolvePrompt(prompt: string, placeholders: Readonly<Record<string, string>>): string { |
| 119 | return prompt.replaceAll(/\{\{([A-Z][A-Z0-9_]*)\}\}/g, (match, name: string) => { |
| 120 | const value = Object.hasOwn(placeholders, name) ? placeholders[name] : undefined; |
| 121 | if (value === undefined) throw new Error(`The prompt references ${match}, but this fixture does not provide it`); |
| 122 | return value; |
| 123 | }); |
| 124 | } |
| 125 | |
| 126 | /** The checked-in eval definition of a suite scenario. */ |
| 127 | export function definitionPath(suite: string, scenario: string): string { |
no outgoing calls
no test coverage detected