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

Do not log when user has requested no profile modifications #2131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wesleytodd
Copy link

Currently when you run the following command it will not modify the profile, but it still logs a complaint and asks the user to add it.

$ PROFILE="/dev/null" ./install.sh
...
=> Profile not found. Tried  (as defined in $PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile.
=> Create one of them and run this script again
   OR
=> Append the following lines to the correct file yourself:
...

This changes the behavior so that explicitly setting to /dev/null does not nag you again. The change was simple so I figured I would submit a PR rather than an issue to discuss. Also, I looked at writing a test but having really no experience writing tests for a bash app like this I figured I should see if this seems good before spending too much time.

@wesleytodd
Copy link
Author

I looked at the test failures and I am not sure what is up. I tried running them locally before pushing and aborted when it asked for my root password. Is this expected when running npm t?

@ljharb
Copy link
Member

ljharb commented Dec 6, 2019

Yes, the tests do require sudo privileges.

@ljharb
Copy link
Member

ljharb commented Dec 6, 2019

Looks like tests are failing due to a breaking change in a minor release: alanshaw/david#159

I'll try to work around that on master before rebasing this.

@ljharb
Copy link
Member

ljharb commented Dec 6, 2019

For tests: the install script has all of its functions unit tested except for nvm_do_install (see https://github.com/nvm-sh/nvm/blob/master/test/install_script/nvm_do_install); and then has a few full tests like https://github.com/nvm-sh/nvm/blob/master/test/install_script/nvm_install_with_node_version and https://github.com/nvm-sh/nvm/blob/master/test/install_script/nvm_install_with_aliased_dot.

I think you could add a new test that explicitly tests the stdout/stderr output and asserts that the profile warning does, or does not, appear when expected?

@wesleytodd
Copy link
Author

Awesome, so I am assuming that means you do like the change. I will work on tests for this when I have time. It might be a little bit due to Node Interactive and other things I have planned in Dec, but I won’t abandon it.

@wesleytodd
Copy link
Author

but I won’t abandon it.

Famous last words!

For anyone else seeing this, I think this is a good change and it should just needs some bash tests. Feel free to take it over if you have time before I can get back to this.

@ljharb ljharb added the pull request wanted This is a great way to contribute! Help us out :-D label Mar 29, 2021
@ljharb
Copy link
Member

ljharb commented Mar 29, 2021

(Please don't open a new PR for that, though; please instead comment here with a link to a commit/branch, and I'll pull in the changes)

@wesleytodd
Copy link
Author

Famous last words!

🤣

Honestly I was trying to push netflix to adopt nvm and this was a part of that. That work stalled out (reorgs, reprioritization, etc) and I am not sure I will be getting back to it any time soon. As I said above, anyone who wants to take this and run with it is welcome to.

@ljharb
Copy link
Member

ljharb commented Aug 23, 2023

@wesleytodd keep me posted if there's anything i can do in the future to help that adoption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature requests I want a new feature in nvm! pull request wanted This is a great way to contribute! Help us out :-D
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants