( targetName: string, filePaths: string[], fileSystemExecutor: FileSystemExecutor, )
| 257 | } |
| 258 | |
| 259 | export 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 | } |
no test coverage detected