Skip to content

Commit

Permalink
test_runner: alternative way to filter lcov test results
Browse files Browse the repository at this point in the history
  • Loading branch information
philnash committed Oct 8, 2023
1 parent b9f24d8 commit e4c034a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/parallel/test-runner-output.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ function replaceTestLocationLine(str) {
// file.
function pickTestFileFromLcov(str) {
const lines = str.split(/\n/);
const firstLineOfTestFile = lines.findIndex((line) => line === 'SF:test/fixtures/test-runner/output/output.js');
const lastLineOfTestFile = lines.findIndex((line, index) => index > line && line === 'end_of_record');
const firstLineOfTestFile = lines.findIndex(
(line) => line.startsWith('SF:') && line.trim().endsWith('output.js')
);
const lastLineOfTestFile = lines.findIndex(
(line, index) => index > firstLineOfTestFile && line.trim() === 'end_of_record'
);
return (
lines[0] + '\n' + lines.slice(firstLineOfTestFile, lastLineOfTestFile).join('\n') + '\n'
lines[0] + '\n' + lines.slice(firstLineOfTestFile, lastLineOfTestFile + 1).join('\n') + '\n'
);
}

Expand Down

0 comments on commit e4c034a

Please sign in to comment.