MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / discoverSwiftTestsInFiles

Function discoverSwiftTestsInFiles

src/utils/swift-test-discovery.ts:259–288  ·  view source on GitHub ↗
(
  targetName: string,
  filePaths: string[],
  fileSystemExecutor: FileSystemExecutor,
)

Source from the content-addressed store, hash-verified

257}
258
259export async function discoverSwiftTestsInFiles(
260 targetName: string,
261 filePaths: string[],
262 fileSystemExecutor: FileSystemExecutor,
263): Promise<DiscoveredTestFile[]> {
264 const sortedPaths = [...filePaths].sort();
265 const fileContents = await Promise.all(
266 sortedPaths.map(async (filePath) => {
267 try {
268 const content = await fileSystemExecutor.readFile(filePath, 'utf8');
269 return { filePath, content };
270 } catch {
271 return null;
272 }
273 }),
274 );
275
276 const discoveredFiles: DiscoveredTestFile[] = [];
277 for (const entry of fileContents) {
278 if (!entry) {
279 continue;
280 }
281 const result = discoverTestsInFileContent(targetName, entry.filePath, entry.content);
282 if (result) {
283 discoveredFiles.push(result);
284 }
285 }
286
287 return discoveredFiles;
288}

Callers 2

resolveTestPreflightFunction · 0.90

Calls 3

readFileMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected