* Initialize the test pool if not already done * This is called lazily to avoid state pollution issues during construction
()
| 408 | * This is called lazily to avoid state pollution issues during construction |
| 409 | */ |
| 410 | _initializeTestPool() { |
| 411 | if (this.testPoolInitialized) { |
| 412 | return |
| 413 | } |
| 414 | |
| 415 | // Ensure codecept is initialized |
| 416 | if (!this.codecept) { |
| 417 | output.log('Warning: codecept not initialized when initializing test pool') |
| 418 | this.testPoolInitialized = true |
| 419 | return |
| 420 | } |
| 421 | |
| 422 | const files = this.codecept.testFiles |
| 423 | if (!files || files.length === 0) { |
| 424 | this.testPoolInitialized = true |
| 425 | return |
| 426 | } |
| 427 | |
| 428 | // In ESM, test UIDs are not stable across different mocha instances |
| 429 | // So instead of using UIDs, we distribute test FILES |
| 430 | // Each file may contain multiple tests |
| 431 | for (const file of files) { |
| 432 | this.testPool.push(file) |
| 433 | } |
| 434 | |
| 435 | this.testPoolInitialized = true |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * Gets the next test from the pool |
no test coverage detected