Skip to content
Merged
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
60 changes: 31 additions & 29 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10024,20 +10024,20 @@ const showAnnotations = async (compareFileData) => {
);

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

const linesWord = linesToDisplay.length === 1 ? "line is" : "lines are";

const formattedLines = linesToDisplay.join(", ");

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}`);
lines.forEach((line) => {
const message = () => {
if (Array.isArray(line)) {
return `file=${file},line=${line[0]},endLine=${
line[line.length - 1]
}::${line.join("-")} lines are not covered with tests`;
}
return `file=${file},line=${line}::${line} line is 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()}`);
});
});
}
};
Expand Down Expand Up @@ -10572,111 +10572,111 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.1","description":"P
/***/ ((module) => {

"use strict";
module.exports = require("assert");;
module.exports = require("assert");

/***/ }),

/***/ 8614:
/***/ ((module) => {

"use strict";
module.exports = require("events");;
module.exports = require("events");

/***/ }),

/***/ 5747:
/***/ ((module) => {

"use strict";
module.exports = require("fs");;
module.exports = require("fs");

/***/ }),

/***/ 8605:
/***/ ((module) => {

"use strict";
module.exports = require("http");;
module.exports = require("http");

/***/ }),

/***/ 7211:
/***/ ((module) => {

"use strict";
module.exports = require("https");;
module.exports = require("https");

/***/ }),

/***/ 1631:
/***/ ((module) => {

"use strict";
module.exports = require("net");;
module.exports = require("net");

/***/ }),

/***/ 2087:
/***/ ((module) => {

"use strict";
module.exports = require("os");;
module.exports = require("os");

/***/ }),

/***/ 5622:
/***/ ((module) => {

"use strict";
module.exports = require("path");;
module.exports = require("path");

/***/ }),

/***/ 2413:
/***/ ((module) => {

"use strict";
module.exports = require("stream");;
module.exports = require("stream");

/***/ }),

/***/ 4016:
/***/ ((module) => {

"use strict";
module.exports = require("tls");;
module.exports = require("tls");

/***/ }),

/***/ 3867:
/***/ ((module) => {

"use strict";
module.exports = require("tty");;
module.exports = require("tty");

/***/ }),

/***/ 8835:
/***/ ((module) => {

"use strict";
module.exports = require("url");;
module.exports = require("url");

/***/ }),

/***/ 1669:
/***/ ((module) => {

"use strict";
module.exports = require("util");;
module.exports = require("util");

/***/ }),

/***/ 8761:
/***/ ((module) => {

"use strict";
module.exports = require("zlib");;
module.exports = require("zlib");

/***/ })

Expand Down Expand Up @@ -10715,7 +10715,9 @@ module.exports = require("zlib");;
/************************************************************************/
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
Expand Down
28 changes: 14 additions & 14 deletions src/features/showAnnotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ const showAnnotations = async (compareFileData) => {
);

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

const linesWord = linesToDisplay.length === 1 ? "line is" : "lines are";

const formattedLines = linesToDisplay.join(", ");

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

// NOTE: consider an option to show lines directly by attaching 'line' param
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the case of this comment. Under what conditions does it occur?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is more an issue for Node.js applications coverage reports, mentioned here #40

I think it's great to remove this comment, I will check one more if we can get it fixed before running this action.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'll revert back to comment.

// Need to fix the issue where we consider 'empty line' as covered line
// Empty lines should not interapt uncovered interval
core.info(`::${showAnnotationsInput} ${message}`);
lines.forEach((line) => {
const message = () => {
if (Array.isArray(line)) {
return `file=${file},line=${line[0]},endLine=${
line[line.length - 1]
}::${line.join("-")} lines are not covered with tests`;
}
return `file=${file},line=${line}::${line} line is 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()}`);
});
});
}
};
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},line=${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},line=1,endLine=4::1-4 lines are not covered with tests`
]);
});
});
Expand Down