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

test: mock maven and npm providers in unitests #67

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

zvigrinberg
Copy link
Collaborator

Description

For maven-Java and npm-javascript package managers/providers, mock/stub interactions with mvn and npm cli tools.
that is, instead of actually invoking the cli, prepare files for each use case that will read the output of that file and will put it in the temp output file that the regular logic flow works with.

Motivations and Reasons

  1. In pure unit-test , only the logic of the API library should be checked, and not the integration with package managers.
    Integration with package managers( and with exhort backend) will be tested in integrations tests.

  2. critical reason to mock/stub interactions with package manager - in npm, from time to time, the versions are changed, if the package-lock.json is changed, and in this case, for component analysis, it might break the tests and force you to change the expected sbom.json files from time to time.

  3. It takes a lot of time to run tests ( especially in case of maven).

Checklist

  • I have followed this repository's contributing guidelines.
  • I will adhere to the project's code of conduct.

Additional information

Anything else?

test: adapt mocha and c8 to test rewired modules

Signed-off-by: Zvi Grinberg <[email protected]>
@zvigrinberg zvigrinberg merged commit d91b678 into main Oct 30, 2023
5 checks passed
@zvigrinberg zvigrinberg deleted the mock-maven-npm-providers-ut branch October 30, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant