MCPcopy Create free account
hub / github.com/CopilotKit/aimock / loadFixtureFile

Function loadFixtureFile

src/fixture-loader.ts:131–158  ·  view source on GitHub ↗
(filePath: string, logger?: Logger)

Source from the content-addressed store, hash-verified

129}
130
131export function loadFixtureFile(filePath: string, logger?: Logger): Fixture[] {
132 let raw: string;
133 try {
134 raw = readFileSync(filePath, "utf-8");
135 } catch (err) {
136 warn(logger, `Could not read file ${filePath}:`, err);
137 return [];
138 }
139
140 let parsed: unknown;
141 try {
142 parsed = JSON.parse(raw);
143 } catch (err) {
144 warn(logger, `Invalid JSON in ${filePath}:`, err);
145 return [];
146 }
147
148 if (
149 typeof parsed !== "object" ||
150 parsed === null ||
151 !Array.isArray((parsed as FixtureFile).fixtures)
152 ) {
153 warn(logger, `Missing or invalid "fixtures" array in ${filePath}`);
154 return [];
155 }
156
157 return (parsed as FixtureFile).fixtures.map((e) => entryToFixture(e, logger));
158}
159
160export function loadFixturesFromDir(dirPath: string, logger?: Logger): Fixture[] {
161 let entries: string[];

Callers 12

loadFixturesFunction · 0.85
loadFixturesFromDirFunction · 0.85
loadFixturesFunction · 0.85
loadFixtureFileMethod · 0.85
loadSourceFunction · 0.85
recorder.test.tsFile · 0.85

Calls 2

warnFunction · 0.85
entryToFixtureFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…