* Run tests in parallel with progress display
( adaptersToRun: AdapterDefinition[], testsToRun: TestDefinition[], concurrency: number, verbose: boolean, )
| 167 | * Run tests in parallel with progress display |
| 168 | */ |
| 169 | async function runParallel( |
| 170 | adaptersToRun: AdapterDefinition[], |
| 171 | testsToRun: TestDefinition[], |
| 172 | concurrency: number, |
| 173 | verbose: boolean, |
| 174 | ): Promise<AdapterResult[]> { |
| 175 | // Build task queue |
| 176 | const tasks: TestTask[] = [] |
| 177 | const resultsMap = new Map<string, AdapterResult>() |
| 178 | const skippedAdapters: string[] = [] |
| 179 | |
| 180 | // Handle tests that don't need an adapter (mock/simulated tests) |
| 181 | const mockTests = testsToRun.filter((t) => !t.requiresAdapter) |
| 182 | if (mockTests.length > 0) { |
| 183 | // Add Mock adapter result for simulated tests |
| 184 | const mockResult: AdapterResult = { |
| 185 | adapter: 'Mock', |
| 186 | tests: {}, |
| 187 | } |
| 188 | resultsMap.set('mock', mockResult) |
| 189 | for (const mockTest of mockTests) { |
| 190 | tasks.push({ |
| 191 | adapterDef: null, |
| 192 | adapterSet: null, |
| 193 | test: mockTest, |
| 194 | verbose, |
| 195 | }) |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | // Handle tests that require adapters |
| 200 | const adapterTests = testsToRun.filter((t) => t.requiresAdapter) |
| 201 | |
| 202 | for (const adapterDef of adaptersToRun) { |
| 203 | const adapterSet = await adapterDef.create() |
| 204 | |
| 205 | if (!adapterSet) { |
| 206 | skippedAdapters.push(`${adapterDef.name} (${adapterDef.envKey} not set)`) |
| 207 | continue |
| 208 | } |
| 209 | |
| 210 | // Initialize result for this adapter |
| 211 | const adapterResult: AdapterResult = { |
| 212 | adapter: adapterDef.name, |
| 213 | tests: {}, |
| 214 | } |
| 215 | resultsMap.set(adapterDef.id, adapterResult) |
| 216 | |
| 217 | for (const test of adapterTests) { |
| 218 | tasks.push({ adapterDef, adapterSet, test, verbose }) |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | // Show skipped adapters |
| 223 | if (skippedAdapters.length > 0) { |
| 224 | console.log(`⚠️ Skipping: ${skippedAdapters.join(', ')}`) |
| 225 | } |
| 226 |
no test coverage detected