mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-12 01:54:53 -04:00
fix: end with \n when pnpm audit finds nothing (#3134)
* End with \n when `pnpm audit` finds nothing * test: new line in the end of audit output Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
5
.changeset/gentle-geese-camp.md
Normal file
5
.changeset/gentle-geese-camp.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-audit": patch
|
||||
---
|
||||
|
||||
Audit output should always have a new line at the end.
|
||||
@@ -141,7 +141,7 @@ export async function handler (
|
||||
}
|
||||
|
||||
function reportSummary (vulnerabilities: AuditVulnerabilityCounts, totalVulnerabilityCount: number) {
|
||||
if (totalVulnerabilityCount === 0) return 'No known vulnerabilities found'
|
||||
if (totalVulnerabilityCount === 0) return 'No known vulnerabilities found\n'
|
||||
return `${chalk.red(totalVulnerabilityCount)} vulnerabilities found\nSeverity: ${
|
||||
Object.entries(vulnerabilities)
|
||||
.filter(([auditLevel, vulnerabilitiesCount]) => vulnerabilitiesCount > 0)
|
||||
|
||||
@@ -69,7 +69,7 @@ test('audit: no vulnerabilities', async () => {
|
||||
},
|
||||
})
|
||||
|
||||
expect(stripAnsi(output)).toBe('No known vulnerabilities found')
|
||||
expect(stripAnsi(output)).toBe('No known vulnerabilities found\n')
|
||||
expect(exitCode).toBe(0)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user