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

Fix: nvm tests in envcontext.test.js #1362

Merged
merged 9 commits into from
Sep 8, 2024
Merged

Fix: nvm tests in envcontext.test.js #1362

merged 9 commits into from
Sep 8, 2024

Conversation

aryan-rajoria
Copy link
Collaborator

@aryan-rajoria aryan-rajoria commented Sep 7, 2024

Fix nvm tests in envcontext.test.js.
It should test the following functions:

  1. getNvmToolDirectory
  2. getOrInstallNvmTool
  3. isNvmAvailable

there are some issues here as CircleCI does not actually have nvm but does have NVM_DIR in env.

Signed-off-by: Aryan Rajoria <[email protected]>
@prabhu
Copy link
Collaborator

prabhu commented Sep 7, 2024

nvm is a large bash function that only exists in the shell that loads the nvm.sh file. Some CI might make it difficult to load and execute all commands from the same shell. Can you share the circle CI configuration, so that we can see if any workarounds are possible?

Signed-off-by: Aryan Rajoria <[email protected]>
Signed-off-by: Aryan Rajoria <[email protected]>
@aryan-rajoria
Copy link
Collaborator Author

nvm is a large bash function that only exists in the shell that loads the nvm.sh file. Some CI might make it difficult to load and execute all commands from the same shell. Can you share the circle CI configuration, so that we can see if any workarounds are possible?

I test if nvm is available with isNvmAvailable(). If it is true, I test the getNvmToolDirectory and getOrInstallNvmTool. If it is false both of these function are not used and would return false as they use nvm.

So I believe this should not cause issues with CircleCi (these function are never meant to run in conditions where nvm is not present, we use different functions for those).

I would appreciate your feedback on whether this approach is acceptable or if I need to modify the tests.

@aryan-rajoria aryan-rajoria marked this pull request as ready for review September 7, 2024 15:23
@prabhu
Copy link
Collaborator

prabhu commented Sep 8, 2024

file:///home/runner/work/cdxgen/cdxgen/pregen.js:192
  return result.status === 0;
  ^

ReferenceError: result is not defined
    at tryLoadNvmAndInstallTool (file:///home/runner/work/cdxgen/cdxgen/pregen.js:192:3)

https://github.com/CycloneDX/cdxgen/actions/runs/10752403424/job/29820700978?pr=1362#step:56:20

Signed-off-by: Aryan Rajoria <[email protected]>
Signed-off-by: Aryan Rajoria <[email protected]>
Signed-off-by: Aryan Rajoria <[email protected]>
Signed-off-by: Aryan Rajoria <[email protected]>
@prabhu
Copy link
Collaborator

prabhu commented Sep 8, 2024

Waiting for repo tests to complete. We should look into biome to see why it is missing certain basic checks like variables undefined which are caught by eslint. The second category of such coding bugs in our project is missing await.

@prabhu
Copy link
Collaborator

prabhu commented Sep 8, 2024

This is a strange error for denotests which are not reproducible locally on Windows.

rm: cannot remove 'node_modules/.pnpm/@[email protected]/node_modules/@appthreat/atom/plugins/lib/au.com.bytecode.opencsv-2.4.jar': Device or resource busy
rm: cannot remove 'node_modules/.pnpm/@[email protected]/node_modules/@appthreat/atom/plugins/lib/ca.mcgill.sable.jasmin-3.0.3.jar': Device or resource busy

@prabhu prabhu merged commit 38cd3df into master Sep 8, 2024
22 of 25 checks passed
@prabhu prabhu deleted the nvm-support-tests branch September 8, 2024 14:30
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.

2 participants