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
4 changes: 2 additions & 2 deletions src/output/printers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export function printActionSummary(findings: Finding[], overrideCount = 0, packa
console.log(`- ${chalk.gray("Package manager:")} ${packageManager}`);
}
if (findings.length > 0) {
console.log(`- ${chalk.green(String(direct))} vulnerable ${pluralize(direct, "package")} look directly fixable in this project.`);
console.log(`- ${chalk.yellow(String(transitive))} ${pluralize(transitive, "issue")} come through other dependencies.`);
console.log(`- ${chalk.green(String(direct))} vulnerable ${pluralize(direct, "package")} ${direct === 1 ? "looks" : "look"} directly fixable in this project.`);
console.log(`- ${chalk.yellow(String(transitive))} ${pluralize(transitive, "issue")} ${transitive === 1 ? "comes" : "come"} through other dependencies.`);
if (unknown > 0) {
console.log(`- ${chalk.magenta(String(unknown))} ${pluralize(unknown, "package")} could not be clearly classified as direct or transitive.`);
}
Expand Down
18 changes: 16 additions & 2 deletions tests/output.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1273,8 +1273,22 @@ describe("output printers", () => {

expect(lines[0]).toContain("✗ Found 2 packages (2 CVEs) with known OSV matches from package-lock");
expect(lines.join("\n")).toContain("Quick take");
expect(lines.join("\n")).toContain("1 vulnerable package look directly fixable in this project.");
expect(lines.join("\n")).toContain("1 issue come through other dependencies.");
expect(lines.join("\n")).toContain("1 vulnerable package looks directly fixable in this project.");
expect(lines.join("\n")).toContain("1 issue comes through other dependencies.");
});

it("keeps plural verbs in the action summary", () => {
const findings = [
createFinding({ relationship: "direct" }),
createFinding({ relationship: "direct" }),
createFinding(),
createFinding(),
];

const output = captureLogs(() => printActionSummary(findings)).join("\n");

expect(output).toContain("2 vulnerable packages look directly fixable in this project.");
expect(output).toContain("2 issues come through other dependencies.");
});

it("prints a table and final status for findings", () => {
Expand Down