MCPcopy
hub / github.com/jestjs/jest / makeTestResults

Function makeTestResults

packages/jest-circus/src/utils.ts:385–408  ·  view source on GitHub ↗
(
  describeBlock: Circus.DescribeBlock,
)

Source from the content-addressed store, hash-verified

383};
384
385const 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)

Callers 1

makeRunResultFunction · 0.85

Calls 1

makeSingleTestResultFunction · 0.85

Tested by

no test coverage detected