* @param {number} idx * @param {TestEnvironment[][]} testOptions * @returns {TestEnvironment[]}
(idx, testOptions)
| 246 | * @returns {TestEnvironment[]} |
| 247 | */ |
| 248 | function buildTestEnvironments (idx, testOptions) { |
| 249 | let baseEnvironments = testOptions[idx] |
| 250 | |
| 251 | if (idx === 0) { |
| 252 | // We're at the beginning |
| 253 | baseEnvironments = baseEnvironments.map( |
| 254 | environment => joinEnvironments(BASE_TEST_ENVIRONMENT, environment)) |
| 255 | } |
| 256 | |
| 257 | if (idx + 1 >= testOptions.length) { |
| 258 | // We're at the end, nothing more to make a matrix out of |
| 259 | return baseEnvironments |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * @type {TestEnvironment[]} |
| 264 | */ |
| 265 | const environments = [] |
| 266 | |
| 267 | // Get all of the environments below us |
| 268 | const subEnvironments = buildTestEnvironments(idx + 1, testOptions) |
| 269 | |
| 270 | for (const baseEnvironment of baseEnvironments) { |
| 271 | const combinedEnvironments = subEnvironments.map( |
| 272 | subEnvironment => joinEnvironments(baseEnvironment, subEnvironment)) |
| 273 | |
| 274 | environments.push(...combinedEnvironments) |
| 275 | } |
| 276 | |
| 277 | return environments |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * @param {Array<() => Promise<WorkerResult>>} jobs |
no test coverage detected