Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/features/showAnnotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,18 @@ const showAnnotations = async (compareFileData) => {
);

fileLinesWithChangedFiles.forEach(({ file, lines }) => {
const linesToDisplay = lines.map((line) =>
Array.isArray(line) ? line.join("-") : line
);
lines.forEach((line) => {
const linesWord = Array.isArray(line) ? "lines are" : "line is";

const linesWord = linesToDisplay.length === 1 ? "line is" : "lines are";
const formattedLines = Array.isArray(line) ? line.join("-") : line;

const formattedLines = linesToDisplay.join(", ");
const message = `file=${file}#L${formattedLines}::${formattedLines} ${linesWord} not covered with tests`;

const message = `file=${file}::${formattedLines} ${linesWord} not covered with tests`;

// NOTE: consider an option to show lines directly by attaching 'line' param
// Need to fix the issue where we consider 'empty line' as covered line
// Empty lines should not interapt uncovered interval
core.info(`::${showAnnotationsInput} ${message}`);
// NOTE: consider an option to show lines directly by attaching 'line' param
// Need to fix the issue where we consider 'empty line' as covered line
// Empty lines should not interapt uncovered interval
core.info(`::${showAnnotationsInput} ${message}`);
});
});
}
};
Expand Down
6 changes: 3 additions & 3 deletions tests/features/showAnnotations.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe("features/showAnnotations", () => {
assert.isTrue(mergeFileLinesWithChangedFiles.calledOnce);
assert.isTrue(info.calledTwice);
assert.deepEqual(info.secondCall.args, [
`::warning file=${filename}::${line} line is not covered with tests`
`::warning file=${filename}#L${line}::${line} line is not covered with tests`
]);
});

Expand Down Expand Up @@ -111,9 +111,9 @@ describe("features/showAnnotations", () => {
assert.isTrue(getChangedFiles.calledOnce);
assert.isTrue(uncoveredFileLinesByFileNames.calledOnce);
assert.isTrue(mergeFileLinesWithChangedFiles.calledOnce);
assert.isTrue(info.calledTwice);
assert.equal(info.callCount, 4);
assert.deepEqual(info.secondCall.args, [
`::warning file=${filename}::1-4, 8, 45-50 lines are not covered with tests`
`::warning file=${filename}#L1-4::1-4 lines are not covered with tests`
]);
});
});
Expand Down