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

Function sortTests

e2e/Utils.ts:284–300  ·  view source on GitHub ↗
(stdout: string)

Source from the content-addressed store, hash-verified

282};
283
284const sortTests = (stdout: string) =>
285 stdout
286 .split('\n')
287 .reduce<Array<Array<string>>>((tests, line) => {
288 if (['RUNS', 'PASS', 'FAIL'].includes(line.slice(0, 4))) {
289 tests.push([line]);
290 } else {
291 tests.at(-1)!.push(line);
292 }
293 return tests;
294 }, [])
295 .sort(([a], [b]) => (a > b ? 1 : -1))
296 .map(strings =>
297 strings.length > 1 ? `${strings.join('\n').trimEnd()}\n` : strings[0],
298 )
299 .join('\n')
300 .trim();
301
302export const extractSortedSummary = (stdout: string) => {
303 const {rest, summary} = extractSummary(stdout);

Callers 1

extractSortedSummaryFunction · 0.85

Calls 1

sortMethod · 0.45

Tested by

no test coverage detected