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 exec: Do a version check on nvm-exec #3308

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

userwiths
Copy link

@userwiths userwiths commented Mar 6, 2024

This check would display a message in case the .nvmrc version is not installed, and would not alter the output otherwise.

nvm_ensure_version_installed returns the message that we care for.
It requires an argument (version) against which to do the check, which we get after calling nvm_rc_version

Fixes #1769

This check would display a message in case the `.nvmrc` version is not installed, and would not alter the output otherwise.
This check would display a message in case the `.nvmrc` version is not installed, and would not alter the output otherwise.
faeelz70

This comment was marked as spam.

@ljharb ljharb force-pushed the master branch 2 times, most recently from c6cfc3a to c20db2a Compare June 10, 2024 18:13
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would need tests

@ljharb ljharb marked this pull request as draft July 26, 2024 23:44
@userwiths
Copy link
Author

A test case was added that checks if the message printed out contains the relevant information (different version of node).

@userwiths userwiths requested a review from ljharb July 30, 2024 08:58
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! (I'm going to tweak the test to be "fast" instead of "slow", and to use a "never can exist" version instead of needing to remove a version, but otherwise this is great!)

@ljharb ljharb marked this pull request as ready for review July 30, 2024 17:40
@ljharb ljharb changed the title fix: Do a version check on nvm-exec [Fix] nvm exec: Do a version check on nvm-exec Jul 30, 2024
@ljharb ljharb force-pushed the fork-dev branch 2 times, most recently from 50480e4 to 05feeaa Compare July 30, 2024 18:19
@ljharb
Copy link
Member

ljharb commented Jul 30, 2024

Unfortunately there's 10 tests failing. It's possible it's just that the expected output needs to be updated to reflect the change, but I might not have time to work on it soon, so it'd be great if you could take a look :-)

@ljharb ljharb marked this pull request as draft July 30, 2024 18:26
@userwiths
Copy link
Author

Gave it a quick look.
The issues that came from my test were related to me forgetting to remove the .nvmrc that I create during the test.

Also saw that the version color printing test was failing, and went ahead and updated it.

Currently staying on 7 errors when running in the docker container, but all other failures seem unrelated to the current changes and a bit more time consuming to debug.

@userwiths userwiths marked this pull request as ready for review July 31, 2024 14:12
@userwiths userwiths requested a review from ljharb July 31, 2024 14:12
@@ -16,3 +16,4 @@ No NODE_VERSION provided; no .nvmrc file found";

# Skip install, we want to test the error message
diff <(echo "${EXPECTED}") <(echo "${OUTPUT}")
rm .nvmrc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha, good catch. note tho that this doesn't actually restore what might already be present - we should back up and restore the existing .nvmrc in setup/teardown files

i'll take a crack at this part tho

No NODE_VERSION provided; no .nvmrc file found";

# Skip install, we want to test the error message
diff <(echo "${EXPECTED}") <(echo "${OUTPUT}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line can't work tho, due to https://www.shellcheck.net/wiki/SC3001 - i'll change this to a normal = comparison unless you have a better idea

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sound reasonable.
Was hoping that the #!/bin/bash on top would allow for that to pass, but I think = should work too.

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.

nvm says 'no .nvmrc file found' when the problem is that the version inside of said .nvmrc is not installed.
3 participants