Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test : for invalid package-lock.json file #4787

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
test: add test for invalid package-lock.json file
Signed-off-by: asim <[email protected]>
asimchoudhary committed Feb 8, 2025
commit c6ad201de590c9a34f7e4c9ccbbe95d999fd99af
1 change: 1 addition & 0 deletions test/language_data/package-lock-invalid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
15 changes: 15 additions & 0 deletions test/test_language_scanner.py
Original file line number Diff line number Diff line change
@@ -203,6 +203,21 @@ def test_javascript_package_none_found(self, filename: str) -> None:
for product in scanner.scan_file(filename):
pass
assert product is not None

@pytest.mark.parametrize(
"filename",((str(TEST_FILE_PATH/"package-lock-invalid.json")))
)

def test_invalid_lock_package(self , filename:str)-> None:
'''
A Test for the invalid package-lock.json file
'''
scanner = VersionScanner()
product = None
for product in scanner.scan_file(filename):
pass
assert product is None


@pytest.mark.parametrize(
"filename",