(fixtureName: string)
| 46 | * ``` |
| 47 | */ |
| 48 | export function loadFixtureConfig(fixtureName: string): { sources: SourceConfig[]; tools?: any[] } { |
| 49 | const fixturePath = fixtureTomlPath(fixtureName); |
| 50 | |
| 51 | if (!fs.existsSync(fixturePath)) { |
| 52 | throw new Error(`Fixture file not found: ${fixturePath}`); |
| 53 | } |
| 54 | |
| 55 | // Temporarily set --config flag to point to fixture |
| 56 | const originalArgv = process.argv; |
| 57 | try { |
| 58 | process.argv = ['node', 'test', '--config', fixturePath]; |
| 59 | const config = loadTomlConfig(); |
| 60 | |
| 61 | if (!config || !config.sources) { |
| 62 | throw new Error(`Failed to load fixture: ${fixtureName}`); |
| 63 | } |
| 64 | |
| 65 | return { |
| 66 | sources: config.sources, |
| 67 | tools: config.tools, |
| 68 | }; |
| 69 | } finally { |
| 70 | process.argv = originalArgv; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Create and connect a ConnectorManager with sources from a TOML fixture |
no test coverage detected