MCPcopy Create free account
hub / github.com/bytebase/dbhub / loadFixtureConfig

Function loadFixtureConfig

src/__fixtures__/helpers.ts:48–72  ·  view source on GitHub ↗
(fixtureName: string)

Source from the content-addressed store, hash-verified

46 * ```
47 */
48export 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

Calls 2

fixtureTomlPathFunction · 0.85
loadTomlConfigFunction · 0.85

Tested by

no test coverage detected