(
params: {
workspacePath?: string;
projectPath?: string;
scheme: string;
configuration: string;
extraArgs?: string[];
destinationName: string;
},
fileSystemExecutor: FileSystemExecutor,
)
| 355 | } |
| 356 | |
| 357 | export 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 | ), |
no test coverage detected