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

Function collectSpecs

packages/jest-jasmine2/src/index.ts:42–79  ·  view source on GitHub ↗
(
  suite: SuiteLike,
  ancestors: Array<string>,
  testNamePatternRE: RegExp | null,
)

Source from the content-addressed store, hash-verified

40};
41
42export const collectSpecs = (
43 suite: SuiteLike,
44 ancestors: Array<string>,
45 testNamePatternRE: RegExp | null,
46): Array<AssertionResult> => {
47 const results: Array<AssertionResult> = [];
48 for (const child of suite.children) {
49 if ('children' in child) {
50 results.push(
51 ...collectSpecs(
52 child,
53 [...ancestors, child.description],
54 testNamePatternRE,
55 ),
56 );
57 } else {
58 const fullName = child.getFullName();
59 if (!testNamePatternRE || testNamePatternRE.test(fullName)) {
60 results.push({
61 ancestorTitles: [...ancestors],
62 duration: null,
63 failing: false,
64 failureDetails: [],
65 failureMessages: [],
66 fullName,
67 invocations: 0,
68 location: null,
69 numPassingAsserts: 0,
70 retryReasons: [],
71 startAt: null,
72 status: 'pending',
73 title: child.description,
74 });
75 }
76 }
77 }
78 return results;
79};
80
81export const buildCollectedTestResult = ({
82 config,

Callers 2

buildCollectedTestResultFunction · 0.85

Calls 2

getFullNameMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected