-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(plugin-js-packages): filter out warnings
- Loading branch information
1 parent
c23e38e
commit e11dab3
Showing
5 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
packages/plugin-js-packages/src/lib/package-managers/pnpm/audit-result.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,62 @@ describe('pnpmToAuditResult', () => { | |
summary: { critical: 0, high: 0, moderate: 0, low: 0, info: 0, total: 0 }, | ||
}); | ||
}); | ||
|
||
it('should filter out warnings from the input', () => { | ||
/* eslint-disable no-irregular-whitespace */ | ||
const inputWithWarnings = ` | ||
WARN Unsupported engine | ||
WARN Issue while reading file | ||
{ | ||
"advisories": { | ||
"123": { | ||
"module_name": "@cypress/request", | ||
"id": 123, | ||
"severity": "high", | ||
"vulnerable_versions": "<2.88.12", | ||
"recommendation": "Upgrade to version 2.88.12 or later", | ||
"title": "SSR forgery", | ||
"url": "https://github.com/advisories", | ||
"findings": [ | ||
{ "paths": [". > @cypress/[email protected]"] } | ||
] | ||
} | ||
}, | ||
"metadata": { | ||
"vulnerabilities": { | ||
"critical": 0, | ||
"high": 1, | ||
"moderate": 0, | ||
"low": 0, | ||
"info": 0 | ||
} | ||
} | ||
} | ||
`; | ||
/* eslint-enable no-irregular-whitespace */ | ||
expect(pnpmToAuditResult(inputWithWarnings)).toEqual<AuditResult>({ | ||
vulnerabilities: [ | ||
{ | ||
name: '@cypress/request', | ||
id: 123, | ||
severity: 'high', | ||
versionRange: '<2.88.12', | ||
fixInformation: 'Upgrade to version 2.88.12 or later', | ||
directDependency: true, | ||
title: 'SSR forgery', | ||
url: 'https://github.com/advisories', | ||
}, | ||
], | ||
summary: { | ||
critical: 0, | ||
high: 1, | ||
moderate: 0, | ||
low: 0, | ||
info: 0, | ||
total: 1, | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('pnpmToDirectDependency', () => { | ||
|
5 changes: 4 additions & 1 deletion
5
packages/plugin-js-packages/src/lib/package-managers/pnpm/outdated-result.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/plugin-js-packages/src/lib/package-managers/pnpm/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const filterWarnings = (output: string): string => | ||
output | ||
.split('\n') | ||
.filter(line => !line.includes('WARN')) | ||
.join('\n'); |