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

[Tests] add tests for "make 'nvm use' display '.nvmrc' version" #1258

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jumbosushi
Copy link
Contributor

@jumbosushi jumbosushi commented Oct 11, 2016

Addition of tests was asked by @ljharb for the pull request #1187 started by @anchnk, which was to display the versions of .nvmrc when "nvm use" is called.

This PR is a continuation of #1187 to add tests.

Let me know if anything needs to be changed!

EDIT: Added .nvmrc setup and cleanup in setup_dir and teardown_dir
EDIT2: Better error message

Set $PROVIDED_VERSION equals to $NVM_RC_VERSION only if a .nvmrc file is
present and the user didn't provided a version to use (.ie typed `nvm
use`).

- Behavior before this fix :

nvm use
Found '.nvmrc' with version <v0.10.28>
N/A: version "N/A" is not yet installed.

You need to run "nvm install N/A" to install it before using it.

- Behavior after this fix :

nvm use
Found '.nvmrc' with version <v0.10.28>
N/A: version "v0.10.28" is not yet installed.

You need to run "nvm install v0.10.28" to install it before using it.
@jumbosushi jumbosushi force-pushed the 1187-display-nvrmrc-version-in-nvm-use branch from 15099cd to 662735c Compare October 11, 2016 01:18
@jumbosushi jumbosushi changed the title 1187 display nvrmrc version in nvm use Fix 1187 display nvrmrc version in nvm use Oct 11, 2016
@jumbosushi jumbosushi force-pushed the 1187-display-nvrmrc-version-in-nvm-use branch from 662735c to 8a08df3 Compare October 11, 2016 01:35
@@ -0,0 +1,18 @@
#!/bin/sh
Copy link
Member

Choose a reason for hiding this comment

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

this filename seems to start with a leading space - can you remove it?

Copy link
Member

Choose a reason for hiding this comment

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

Also, can you add set -e - either here, or after the line that sources nvm.sh, if the tests fail when it's here?

Copy link
Contributor Author

@jumbosushi jumbosushi Oct 11, 2016

Choose a reason for hiding this comment

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

Fixed it!
EDIT: Also fix to chmod a+x

@jumbosushi jumbosushi force-pushed the 1187-display-nvrmrc-version-in-nvm-use branch 2 times, most recently from ed14e79 to 3865e3f Compare October 11, 2016 09:24
@jumbosushi
Copy link
Contributor Author

Hm looks like my tests are failing. I will look into this

@ljharb ljharb added feature requests I want a new feature in nvm! bugs Oh no, something's broken :-( needs followup We need some info or action from whoever filed this issue/PR. labels Oct 11, 2016
@jumbosushi jumbosushi force-pushed the 1187-display-nvrmrc-version-in-nvm-use branch 2 times, most recently from 61db95d to 93a587c Compare October 12, 2016 06:47
@jumbosushi jumbosushi force-pushed the 1187-display-nvrmrc-version-in-nvm-use branch from 93a587c to 18a7190 Compare October 21, 2016 05:37
@ljharb
Copy link
Member

ljharb commented Jun 13, 2017

@jumbosushi have you had a chance to look into this?

@anchnk
Copy link

anchnk commented Nov 27, 2017

Is this issue still needs to be opened ? My original one was resolved with new releases of nvm that might be the case for this one as well no ?

@ljharb ljharb force-pushed the 1187-display-nvrmrc-version-in-nvm-use branch from 18a7190 to 0235dc8 Compare December 3, 2017 20:10
@ljharb
Copy link
Member

ljharb commented Dec 3, 2017

The tests are still useful, even if the implementation change isn't.

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.

will land if the test passes

@ljharb ljharb changed the title Fix 1187 display nvrmrc version in nvm use [Tests] add tests for "make 'nvm use' display '.nvmrc' version" Sep 29, 2021
@ljharb ljharb force-pushed the 1187-display-nvrmrc-version-in-nvm-use branch from 2f7b7d2 to 27dea68 Compare September 29, 2021 06:42
@ljharb
Copy link
Member

ljharb commented Sep 29, 2021

Tests failed; i restored the fix from #1187 to see if that makes them pass.

@ljharb
Copy link
Member

ljharb commented Sep 29, 2021

@jumbosushi unfortunately the test fails with or without the fix.

@ljharb ljharb marked this pull request as draft September 29, 2021 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs Oh no, something's broken :-( feature requests I want a new feature in nvm! needs followup We need some info or action from whoever filed this issue/PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants