( describeBlock: Circus.DescribeBlock, )
| 383 | }; |
| 384 | |
| 385 | const makeTestResults = ( |
| 386 | describeBlock: Circus.DescribeBlock, |
| 387 | ): Circus.TestResults => { |
| 388 | const testResults = []; |
| 389 | const stack: [[Circus.DescribeBlock, number]] = [[describeBlock, 0]]; |
| 390 | |
| 391 | while (stack.length > 0) { |
| 392 | const [currentBlock, childIndex] = stack.pop()!; |
| 393 | |
| 394 | for (let i = childIndex; i < currentBlock.children.length; i++) { |
| 395 | const child = currentBlock.children[i]; |
| 396 | |
| 397 | if (child.type === 'describeBlock') { |
| 398 | stack.push([currentBlock, i + 1], [child, 0]); |
| 399 | break; |
| 400 | } |
| 401 | if (child.type === 'test') { |
| 402 | testResults.push(makeSingleTestResult(child)); |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | return testResults; |
| 408 | }; |
| 409 | |
| 410 | // Return a string that identifies the test (concat of parent describe block |
| 411 | // names + test title) |
no test coverage detected