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

Function resolveTestPreflight

src/utils/test-preflight.ts:357–487  ·  view source on GitHub ↗
(
  params: {
    workspacePath?: string;
    projectPath?: string;
    scheme: string;
    configuration: string;
    extraArgs?: string[];
    destinationName: string;
  },
  fileSystemExecutor: FileSystemExecutor,
)

Source from the content-addressed store, hash-verified

355}
356
357export async function resolveTestPreflight(
358 params: {
359 workspacePath?: string;
360 projectPath?: string;
361 scheme: string;
362 configuration: string;
363 extraArgs?: string[];
364 destinationName: string;
365 },
366 fileSystemExecutor: FileSystemExecutor,
367): Promise<TestPreflightResult | null> {
368 const selectors = {
369 onlyTesting: parseSelectors(params.extraArgs, '-only-testing'),
370 skipTesting: parseSelectors(params.extraArgs, '-skip-testing'),
371 };
372
373 const warnings: string[] = [];
374 const schemePath = await findSchemePath(params, fileSystemExecutor);
375 if (!schemePath) {
376 warnings.push(`Could not find shared scheme file for ${params.scheme}.`);
377 return {
378 scheme: params.scheme,
379 configuration: params.configuration,
380 workspacePath: params.workspacePath,
381 projectPath: params.projectPath,
382 destinationName: params.destinationName,
383 selectors,
384 targets: [],
385 warnings,
386 totalTests: 0,
387 completeness: 'unresolved',
388 };
389 }
390
391 const schemeContent = await fileSystemExecutor.readFile(schemePath, 'utf8');
392 const baseDir = path.dirname(params.workspacePath ?? params.projectPath ?? schemePath);
393 const referencedTargets = new Map<string, ReferencedTestTarget>();
394
395 for (const target of parseSchemeTargets(schemeContent)) {
396 referencedTargets.set(target.name, target);
397 }
398 for (const target of await parseTestPlanTargets(schemeContent, baseDir, fileSystemExecutor)) {
399 referencedTargets.set(target.name, target);
400 }
401
402 const targets: ResolvedTestTarget[] = [];
403
404 for (const reference of referencedTargets.values()) {
405 const candidateDirectories = await resolveCandidateDirectories(
406 reference,
407 params,
408 fileSystemExecutor,
409 );
410 const swiftFiles = (
411 await Promise.all(
412 candidateDirectories.map((directoryPath) =>
413 collectSwiftFiles(directoryPath, fileSystemExecutor),
414 ),

Callers 4

prepareTestSimExecutionFunction · 0.90

Calls 10

parseSelectorsFunction · 0.85
findSchemePathFunction · 0.85
parseSchemeTargetsFunction · 0.85
parseTestPlanTargetsFunction · 0.85
collectSwiftFilesFunction · 0.85
applySelectorsFunction · 0.85
pushMethod · 0.80
readFileMethod · 0.80

Tested by

no test coverage detected