mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
015ce80baa
* base: pile foundation * refactor(tools): Split check.ts into modular components - Separate files for types, coverage, git, tui, execution, test-filter - Fix signal handler timing (register at module load) - Export getMatchingShards/getTestPatternsForShards from test-shards.ts
42 lines
783 B
TypeScript
42 lines
783 B
TypeScript
const TEST_OUTPUT_MARKERS = [
|
||
'❯',
|
||
'FAIL',
|
||
'×',
|
||
'Test Files',
|
||
'Tests',
|
||
'Start at',
|
||
'Duration',
|
||
'⎯',
|
||
'Error',
|
||
'expected',
|
||
'Received',
|
||
'Expected',
|
||
];
|
||
|
||
function isRelevantTestLine(line: string): boolean {
|
||
return TEST_OUTPUT_MARKERS.some((marker) => line.includes(marker));
|
||
}
|
||
|
||
export function filterTestOutput(output: string): string {
|
||
const lines = output.split('\n');
|
||
const filtered: string[] = [];
|
||
let capturing = false;
|
||
|
||
for (const line of lines) {
|
||
if (line.includes('✓') && !line.includes('failed')) {
|
||
capturing = false;
|
||
continue;
|
||
}
|
||
|
||
if (isRelevantTestLine(line)) {
|
||
capturing = true;
|
||
}
|
||
|
||
if (capturing || line.trim() === '') {
|
||
filtered.push(line);
|
||
}
|
||
}
|
||
|
||
return filtered.join('\n').trim();
|
||
}
|