-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #761 from actions/juxtin/fix-allow-dependencies-li…
…censes Fix package-url parsing for allow-dependencies-licenses
- Loading branch information
Showing
6 changed files
with
75 additions
and
44 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -54,6 +54,30 @@ test('it raises an error if an empty allow list is specified', async () => { | |
) | ||
}) | ||
|
||
test('it successfully parses allow-dependencies-licenses', async () => { | ||
setInput( | ||
'allow-dependencies-licenses', | ||
'pkg:npm/@test/[email protected],pkg:npm/example' | ||
) | ||
const config = await readConfig() | ||
expect(config.allow_dependencies_licenses).toEqual([ | ||
'pkg:npm/@test/[email protected]', | ||
'pkg:npm/example' | ||
]) | ||
}) | ||
|
||
test('it raises an error when an invalid package-url is used for allow-dependencies-licenses', async () => { | ||
setInput('allow-dependencies-licenses', 'not-a-purl') | ||
await expect(readConfig()).rejects.toThrow(`Error parsing package-url`) | ||
}) | ||
|
||
test('it raises an error when a nameless package-url is used for allow-dependencies-licenses', async () => { | ||
setInput('allow-dependencies-licenses', 'pkg:npm/@namespace/') | ||
await expect(readConfig()).rejects.toThrow( | ||
`Error parsing package-url: name is required` | ||
) | ||
}) | ||
|
||
test('it raises an error when an invalid package-url is used for deny-packages', async () => { | ||
setInput('deny-packages', 'not-a-purl') | ||
|
||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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