Files
renovate/tools/check/test-filter.ts
Sergei Zharinov 015ce80baa chore(tools): Add check script (#40185)
* 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
2026-01-23 01:12:10 +00:00

42 lines
783 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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();
}