fe-core-components 9.9.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fe-core-components might be problematic. Click here for more details.
- package/.dockerignore +16 -0
- package/.editorconfig +28 -0
- package/.gitattributes +1 -0
- package/.github/FUNDING.yml +12 -0
- package/.github/ISSUE_TEMPLATE.md +44 -0
- package/.github/SECURITY.md +3 -0
- package/.github/workflows/latest-npm.yml +76 -0
- package/.github/workflows/lint.yml +73 -0
- package/.github/workflows/rebase.yml +23 -0
- package/.github/workflows/release.yml +32 -0
- package/.github/workflows/require-allow-edits.yml +21 -0
- package/.github/workflows/shellcheck.yml +55 -0
- package/.github/workflows/toc.yml +37 -0
- package/.github/workflows/windows-npm.yml +133 -0
- package/.mailmap +1 -0
- package/.travis.yml +75 -0
- package/CODE_OF_CONDUCT.md +106 -0
- package/CONTRIBUTING.md +21 -0
- package/Dockerfile +111 -0
- package/GOVERNANCE.md +10 -0
- package/LICENSE.md +22 -0
- package/Makefile +85 -0
- package/PROJECT_CHARTER.md +49 -0
- package/README.md +970 -0
- package/ROADMAP.md +9 -0
- package/bash_completion +99 -0
- package/index.js +48 -0
- package/install.sh +463 -0
- package/nvm-exec +15 -0
- package/nvm.sh +4323 -0
- package/package.json +12 -0
- package/package.json.ori +51 -0
- package/rename_test.sh +52 -0
- package/test/common.sh +103 -0
- package/test/fast/Aliases/'nvm alias' should not accept aliases with slashes +26 -0
- package/test/fast/Aliases/'nvm unalias' should accept aliases when they shadow a built-in alias +17 -0
- package/test/fast/Aliases/'nvm unalias' should not accept aliases with names equal to built-in alias +25 -0
- package/test/fast/Aliases/'nvm unalias' should not accept aliases with slashes +26 -0
- package/test/fast/Aliases/Running 'nvm alias /313/202aliasname/313/203 /313/202target/313/203' again should change the target" +24 -0
- package/test/fast/Aliases/Running 'nvm alias /313/202aliasname/313/203' should list but one alias" +4 -0
- package/test/fast/Aliases/Running 'nvm alias' lists implicit aliases when they do not exist +26 -0
- package/test/fast/Aliases/Running 'nvm alias' lists manual aliases instead of implicit aliases when present +49 -0
- package/test/fast/Aliases/Running 'nvm alias' should list all aliases +48 -0
- package/test/fast/Aliases/circular/nvm_resolve_alias +36 -0
- package/test/fast/Aliases/circular/nvm_resolve_local_alias +36 -0
- package/test/fast/Aliases/circular/setup +9 -0
- package/test/fast/Aliases/circular/teardown +9 -0
- package/test/fast/Aliases/lts/'nvm alias' should ensure LTS alias dir exists +18 -0
- package/test/fast/Aliases/lts/setup_dir +10 -0
- package/test/fast/Aliases/lts/teardown_dir +10 -0
- package/test/fast/Aliases/nvm_ensure_default_set +20 -0
- package/test/fast/Aliases/nvm_list_aliases calls nvm_get_colors +22 -0
- package/test/fast/Aliases/nvm_list_aliases works with LTS aliases +25 -0
- package/test/fast/Aliases/nvm_list_aliases works with no LTS aliases present +21 -0
- package/test/fast/Aliases/nvm_print_alias_path calls nvm_get_colors +28 -0
- package/test/fast/Aliases/nvm_print_formatted_alias calls nvm_get_colors +21 -0
- package/test/fast/Aliases/nvm_resolve_alias +33 -0
- package/test/fast/Aliases/nvm_resolve_local_alias +35 -0
- package/test/fast/Aliases/setup +14 -0
- package/test/fast/Aliases/teardown +17 -0
- package/test/fast/Listing paths/Running 'nvm which 0.0.2' should display only version 0.0.2 +27 -0
- package/test/fast/Listing paths/Running 'nvm which foo' should return a nonzero exit code when not found +6 -0
- package/test/fast/Listing paths/teardown +3 -0
- package/test/fast/Listing versions/Running 'nvm ls --no-alias' does not call into nvm_alias +34 -0
- package/test/fast/Listing versions/Running 'nvm ls --no-alias' with a pattern errors +15 -0
- package/test/fast/Listing versions/Running 'nvm ls 0.0.2' should display only version 0.0.2 +21 -0
- package/test/fast/Listing versions/Running 'nvm ls 0.2' should display only 0.2.x versions +42 -0
- package/test/fast/Listing versions/Running 'nvm ls foo' should return a nonzero exit code when not found +6 -0
- package/test/fast/Listing versions/Running 'nvm ls io' should return NA +6 -0
- package/test/fast/Listing versions/Running 'nvm ls node_' should return a nonzero exit code when not found +6 -0
- package/test/fast/Listing versions/Running 'nvm ls stable' and 'nvm ls unstable' should return the appropriate implicit alias +29 -0
- package/test/fast/Listing versions/Running 'nvm ls system' should include 'system' when appropriate +21 -0
- package/test/fast/Listing versions/Running 'nvm ls' calls into nvm_alias +35 -0
- package/test/fast/Listing versions/Running 'nvm ls' should display all installed versions +44 -0
- package/test/fast/Listing versions/Running 'nvm ls' should filter out '.nvm' +10 -0
- package/test/fast/Listing versions/Running 'nvm ls' should filter out 'versions' +10 -0
- package/test/fast/Listing versions/Running 'nvm ls' should include 'system' when appropriate +21 -0
- package/test/fast/Listing versions/Running 'nvm ls' should list versions in the 'versions' directory +12 -0
- package/test/fast/Listing versions/Running 'nvm ls' should not show a trailing slash +40 -0
- package/test/fast/Listing versions/Running 'nvm ls' with node-like versioning vx.x.x should only list a matched version +11 -0
- package/test/fast/Listing versions/Running 'nvm ls' with nounset should not fail +23 -0
- package/test/fast/Listing versions/Using a nonstandard IFS should not break +19 -0
- package/test/fast/Listing versions/teardown +16 -0
- package/test/fast/Running 'nvm alias' should create a file in the alias directory +9 -0
- package/test/fast/Running 'nvm current' should display current nvm environment +11 -0
- package/test/fast/Running 'nvm deactivate' should unset the nvm environment variables +23 -0
- package/test/fast/Running 'nvm install' with '--reinstall-packages-from' requires a valid version +57 -0
- package/test/fast/Running 'nvm install' with an invalid version fails nicely +13 -0
- package/test/fast/Running 'nvm unalias' should remove the alias file +13 -0
- package/test/fast/Running 'nvm uninstall' should remove the appropriate directory +12 -0
- package/test/fast/Running 'nvm uninstall' with incorrect file permissions fails nicely +14 -0
- package/test/fast/Running 'nvm unload' should unset all function and variables +30 -0
- package/test/fast/Running 'nvm use foo' where 'foo' is circular aborts +39 -0
- package/test/fast/Running 'nvm use iojs' uses latest io.js version +37 -0
- package/test/fast/Running 'nvm use system' should work as expected +44 -0
- package/test/fast/Running 'nvm use x' should create and change the 'current' symlink +36 -0
- package/test/fast/Running 'nvm use x' should not create the 'current' symlink if $NVM_SYMLINK_CURRENT is false +86 -0
- package/test/fast/Running 'nvm use' should drop CR char automatically +33 -0
- package/test/fast/Set Colors/nvm_echo_with_colors +21 -0
- package/test/fast/Set Colors/nvm_err_with_colors +19 -0
- package/test/fast/Set Colors/nvm_print_default_alias calls nvm_get_colors +24 -0
- package/test/fast/Set Colors/nvm_print_versions calls nvm_get_colors +52 -0
- package/test/fast/Sourcing nvm.sh should make the nvm command available +7 -0
- package/test/fast/Sourcing nvm.sh should not modify parameters of caller +7 -0
- package/test/fast/Unit tests/mocks/LTS_names.txt +7 -0
- package/test/fast/Unit tests/mocks/iojs.org-dist-index.tab +42 -0
- package/test/fast/Unit tests/mocks/lts-star.txt +1 -0
- package/test/fast/Unit tests/mocks/nodejs.org-dist-index.tab +614 -0
- package/test/fast/Unit tests/mocks/nodejs.org-download-nightly-index.tab +2576 -0
- package/test/fast/Unit tests/mocks/nvm ls-remote iojs.txt +41 -0
- package/test/fast/Unit tests/mocks/nvm ls-remote lts.txt +166 -0
- package/test/fast/Unit tests/mocks/nvm ls-remote node.txt +613 -0
- package/test/fast/Unit tests/mocks/nvm ls-remote.txt +654 -0
- package/test/fast/Unit tests/mocks/nvm_ls_remote LTS argon.txt +36 -0
- package/test/fast/Unit tests/mocks/nvm_ls_remote LTS nightly argon.txt +1 -0
- package/test/fast/Unit tests/mocks/nvm_ls_remote LTS nightly.txt +25 -0
- package/test/fast/Unit tests/mocks/nvm_ls_remote LTS.txt +166 -0
- package/test/fast/Unit tests/mocks/nvm_ls_remote nightly.txt +146 -0
- package/test/fast/Unit tests/mocks/nvm_ls_remote stable nightly.txt +1 -0
- package/test/fast/Unit tests/mocks/nvm_ls_remote stable.txt +1 -0
- package/test/fast/Unit tests/mocks/nvm_ls_remote.txt +613 -0
- package/test/fast/Unit tests/mocks/nvm_ls_remote_iojs.txt +41 -0
- package/test/fast/Unit tests/mocks/nvm_make_alias LTS alias calls.txt +8 -0
- package/test/fast/Unit tests/mocks/nvm_print_implicit_alias remote stable nightly.txt +1 -0
- package/test/fast/Unit tests/mocks/nvm_print_implicit_alias remote stable.txt +1 -0
- package/test/fast/Unit tests/mocks/project_dirs/inside-n_m-nested/node_modules/foo/bar/.gitkeep +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/inside-n_m-nested-pkg/node_modules/foo/bar/.gitkeep +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/inside-n_m-nested-pkg/node_modules/foo/package.json +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/nested-both/a/b/c/d/.gitkeep +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/nested-both/node_modules/.gitkeep +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/nested-both/package.json +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/nested-n_m/a/b/c/d/.gitkeep +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/nested-n_m/node_modules/.gitkeep +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/nested-pkg/a/b/c/d/.gitkeep +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/nested-pkg/package.json +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/no-nesting-both/node_modules/.gitkeep +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/no-nesting-both/package.json +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/no-nesting-n_m/node_modules/.gitkeep +0 -0
- package/test/fast/Unit tests/mocks/project_dirs/no-nesting-pkg/package.json +0 -0
- package/test/fast/Unit tests/nvm ls-remote +73 -0
- package/test/fast/Unit tests/nvm set_colors +52 -0
- package/test/fast/Unit tests/nvm version-remote +51 -0
- package/test/fast/Unit tests/nvm_add_iojs_prefix +9 -0
- package/test/fast/Unit tests/nvm_alias +32 -0
- package/test/fast/Unit tests/nvm_alias LTS-N +36 -0
- package/test/fast/Unit tests/nvm_alias_path +7 -0
- package/test/fast/Unit tests/nvm_change_path +57 -0
- package/test/fast/Unit tests/nvm_check_for_help +9 -0
- package/test/fast/Unit tests/nvm_clang_version +62 -0
- package/test/fast/Unit tests/nvm_command_info +58 -0
- package/test/fast/Unit tests/nvm_compare_checksum +72 -0
- package/test/fast/Unit tests/nvm_compute_checksum +23 -0
- package/test/fast/Unit tests/nvm_curl_libz_support +39 -0
- package/test/fast/Unit tests/nvm_curl_use_compression +38 -0
- package/test/fast/Unit tests/nvm_curl_version +32 -0
- package/test/fast/Unit tests/nvm_die_on_prefix +192 -0
- package/test/fast/Unit tests/nvm_download +18 -0
- package/test/fast/Unit tests/nvm_ensure_default_set +15 -0
- package/test/fast/Unit tests/nvm_ensure_version_installed +63 -0
- package/test/fast/Unit tests/nvm_ensure_version_prefix +12 -0
- package/test/fast/Unit tests/nvm_find_project_dir +33 -0
- package/test/fast/Unit tests/nvm_find_up +25 -0
- package/test/fast/Unit tests/nvm_format_version +20 -0
- package/test/fast/Unit tests/nvm_get_arch +84 -0
- package/test/fast/Unit tests/nvm_get_artifact_compression +22 -0
- package/test/fast/Unit tests/nvm_get_checksum +45 -0
- package/test/fast/Unit tests/nvm_get_checksum_alg +20 -0
- package/test/fast/Unit tests/nvm_get_checksum_binary +20 -0
- package/test/fast/Unit tests/nvm_get_colors +79 -0
- package/test/fast/Unit tests/nvm_get_default_packages +92 -0
- package/test/fast/Unit tests/nvm_get_download_slug +111 -0
- package/test/fast/Unit tests/nvm_get_latest missing curl or wget +20 -0
- package/test/fast/Unit tests/nvm_get_minor_version +45 -0
- package/test/fast/Unit tests/nvm_get_mirror +32 -0
- package/test/fast/Unit tests/nvm_has +11 -0
- package/test/fast/Unit tests/nvm_has_non_aliased +24 -0
- package/test/fast/Unit tests/nvm_has_solaris_binary +32 -0
- package/test/fast/Unit tests/nvm_has_system_iojs +27 -0
- package/test/fast/Unit tests/nvm_has_system_node +27 -0
- package/test/fast/Unit tests/nvm_install_binary_extract +59 -0
- package/test/fast/Unit tests/nvm_install_binary_nosource +30 -0
- package/test/fast/Unit tests/nvm_install_latest_npm +58 -0
- package/test/fast/Unit tests/nvm_install_no_progress_bar +43 -0
- package/test/fast/Unit tests/nvm_iojs_prefix +7 -0
- package/test/fast/Unit tests/nvm_iojs_version_has_solaris_binary +17 -0
- package/test/fast/Unit tests/nvm_is_alias +20 -0
- package/test/fast/Unit tests/nvm_is_iojs_version +10 -0
- package/test/fast/Unit tests/nvm_is_merged_node_version +10 -0
- package/test/fast/Unit tests/nvm_is_natural_num +17 -0
- package/test/fast/Unit tests/nvm_is_valid_version +13 -0
- package/test/fast/Unit tests/nvm_is_version_installed +54 -0
- package/test/fast/Unit tests/nvm_ls_current +39 -0
- package/test/fast/Unit tests/nvm_ls_remote +86 -0
- package/test/fast/Unit tests/nvm_ls_remote LTS aliases +49 -0
- package/test/fast/Unit tests/nvm_ls_remote nightly +65 -0
- package/test/fast/Unit tests/nvm_ls_remote_iojs +37 -0
- package/test/fast/Unit tests/nvm_make_alias +19 -0
- package/test/fast/Unit tests/nvm_node_prefix +7 -0
- package/test/fast/Unit tests/nvm_node_version_has_solaris_binary +33 -0
- package/test/fast/Unit tests/nvm_normalize_lts +38 -0
- package/test/fast/Unit tests/nvm_num_version_groups +24 -0
- package/test/fast/Unit tests/nvm_print_alias_path +44 -0
- package/test/fast/Unit tests/nvm_print_color_code +20 -0
- package/test/fast/Unit tests/nvm_print_default_alias +38 -0
- package/test/fast/Unit tests/nvm_print_implicit_alias errors +25 -0
- package/test/fast/Unit tests/nvm_print_implicit_alias success +106 -0
- package/test/fast/Unit tests/nvm_print_npm_version +28 -0
- package/test/fast/Unit tests/nvm_remote_version +78 -0
- package/test/fast/Unit tests/nvm_remote_versions +77 -0
- package/test/fast/Unit tests/nvm_stdout_is_terminal +32 -0
- package/test/fast/Unit tests/nvm_strip_iojs_prefix +10 -0
- package/test/fast/Unit tests/nvm_strip_path +18 -0
- package/test/fast/Unit tests/nvm_supports_xz +42 -0
- package/test/fast/Unit tests/nvm_tree_contains_path +31 -0
- package/test/fast/Unit tests/nvm_use_if_needed +24 -0
- package/test/fast/Unit tests/nvm_validate_implicit_alias +20 -0
- package/test/fast/Unit tests/nvm_version +48 -0
- package/test/fast/Unit tests/nvm_version_dir +11 -0
- package/test/fast/Unit tests/nvm_version_greater +15 -0
- package/test/fast/Unit tests/nvm_version_path +14 -0
- package/test/fast/nvm should remove the last trailing slash in $NVM_DIR +18 -0
- package/test/fast/setup +14 -0
- package/test/fast/setup_dir +18 -0
- package/test/fast/teardown +12 -0
- package/test/fast/teardown_dir +15 -0
- package/test/install_script/install_nvm_from_git +129 -0
- package/test/install_script/nvm_check_global_modules +63 -0
- package/test/install_script/nvm_detect_profile +118 -0
- package/test/install_script/nvm_do_install +8 -0
- package/test/install_script/nvm_download +18 -0
- package/test/install_script/nvm_install_dir +25 -0
- package/test/install_script/nvm_install_with_aliased_dot +24 -0
- package/test/install_script/nvm_install_with_node_version +12 -0
- package/test/install_script/nvm_profile_is_bash_or_zsh +13 -0
- package/test/install_script/nvm_reset +38 -0
- package/test/install_script/nvm_source +43 -0
- package/test/installation_iojs/install already installed uses it +25 -0
- package/test/installation_iojs/install from binary +22 -0
- package/test/installation_iojs/install from source +22 -0
- package/test/installation_iojs/install two versions and use the latest one +25 -0
- package/test/installation_iojs/install version specified in .nvmrc from binary +22 -0
- package/test/installation_iojs/install version specified in .nvmrc from source +23 -0
- package/test/installation_iojs/install while reinstalling packages +31 -0
- package/test/installation_iojs/nvm install v1 works +19 -0
- package/test/installation_iojs/setup_dir +5 -0
- package/test/installation_iojs/teardown_dir +16 -0
- package/test/installation_node/default-packages +123 -0
- package/test/installation_node/install LTS +29 -0
- package/test/installation_node/install already installed uses it +23 -0
- package/test/installation_node/install from binary +23 -0
- package/test/installation_node/install from binary with binary flag set +37 -0
- package/test/installation_node/install from source +29 -0
- package/test/installation_node/install from source implicitly +23 -0
- package/test/installation_node/install from source with thread parameter +33 -0
- package/test/installation_node/install from source without V8 snapshot for ARM +25 -0
- package/test/installation_node/install hook +45 -0
- package/test/installation_node/install latest npm +51 -0
- package/test/installation_node/install two versions and use the latest one +24 -0
- package/test/installation_node/install version specified in .nvmrc from binary +20 -0
- package/test/installation_node/install version specified in .nvmrc from source +20 -0
- package/test/installation_node/install while reinstalling packages +46 -0
- package/test/installation_node/install with --alias +11 -0
- package/test/installation_node/install with --default +11 -0
- package/test/installation_node/install with --latest-npm +12 -0
- package/test/installation_node/setup_dir +5 -0
- package/test/installation_node/teardown_dir +18 -0
- package/test/mocks/isainfo_amd64 +5 -0
- package/test/mocks/isainfo_x86 +5 -0
- package/test/mocks/pkg_info_amd64 +4 -0
- package/test/mocks/pkg_info_fail +1 -0
- package/test/mocks/pkg_info_x86 +1 -0
- package/test/mocks/uname_osx_amd64 +5 -0
- package/test/mocks/uname_osx_x86 +5 -0
- package/test/mocks/uname_smartos_amd64 +5 -0
- package/test/mocks/uname_smartos_x86 +5 -0
- package/test/slow/Running 'nvm current' should display current nvm environment +9 -0
- package/test/slow/node 0.6.21 should install 0.6.21-pre +11 -0
- package/test/slow/nvm exec/Preamble works and respects 'silent' flag +30 -0
- package/test/slow/nvm exec/Running 'nvm exec --lts' should work +18 -0
- package/test/slow/nvm exec/Running 'nvm exec 0.x' should work +15 -0
- package/test/slow/nvm exec/Running 'nvm exec' should pick up .nvmrc version +16 -0
- package/test/slow/nvm exec/Running 'nvm exec' with help should not parse +9 -0
- package/test/slow/nvm exec/setup_dir +10 -0
- package/test/slow/nvm exec/teardown_dir +13 -0
- package/test/slow/nvm reinstall-packages/Running 'nvm copy-packages $(nvm ls current)' should error out +17 -0
- package/test/slow/nvm reinstall-packages/setup_dir +11 -0
- package/test/slow/nvm reinstall-packages/should work as expected +31 -0
- package/test/slow/nvm reinstall-packages/teardown_dir +13 -0
- package/test/slow/nvm reinstall-packages/test-npmlink/index.js +2 -0
- package/test/slow/nvm reinstall-packages/test-npmlink/package.json +10 -0
- package/test/slow/nvm reinstall-packages/works with no installs +18 -0
- package/test/slow/nvm run/Running 'nvm run --harmony --version' should work +8 -0
- package/test/slow/nvm run/Running 'nvm run --lts' should work +15 -0
- package/test/slow/nvm run/Running 'nvm run 0.x' should error out sensibly when 0.x is not installed +16 -0
- package/test/slow/nvm run/Running 'nvm run 0.x' should work +8 -0
- package/test/slow/nvm run/Running 'nvm run' should pick up .nvmrc version +12 -0
- package/test/slow/nvm run/setup_dir +11 -0
- package/test/slow/nvm run/teardown_dir +14 -0
- package/test/slow/nvm uninstall/Running 'nvm uninstall 0.12.6' uninstalls v0.12.6 +33 -0
- package/test/slow/nvm uninstall/Running 'nvm uninstall' with incorrect file permissions fails nicely +30 -0
- package/test/slow/nvm uninstall/setup_dir +4 -0
- package/test/slow/nvm uninstall/teardown_dir +5 -0
- package/test/slow/nvm use/Running 'nvm use --lts' uses latest LTS version +22 -0
- package/test/slow/nvm use/Running 'nvm use --lts=foo' uses latest 'foo' LTS version +22 -0
- package/test/slow/nvm use/Running 'nvm use iojs' uses latest io.js version +20 -0
- package/test/slow/nvm use/Running 'nvm use node --silent' doesn't print anything +13 -0
- package/test/slow/nvm use/Running 'nvm use node' uses latest stable node version +20 -0
- package/test/slow/nvm use/Running 'nvm use v1.0.0' uses iojs-v1.0.0 iojs version +20 -0
- package/test/slow/nvm use/Running 'nvm use' calls 'nvm_die_on_prefix' +22 -0
- package/test/slow/nvm use/setup_dir +23 -0
- package/test/slow/nvm use/teardown_dir +22 -0
- package/test/slow/nvm_get_latest/nvm_get_latest +101 -0
- package/test/slow/nvm_get_latest/nvm_get_latest failed redirect +25 -0
- package/test/sourcing/Sourcing nvm.sh global alias bug +30 -0
- package/test/sourcing/Sourcing nvm.sh should keep version if one is active +20 -0
- package/test/sourcing/Sourcing nvm.sh should use the default if available and no nvm node is loaded +28 -0
- package/test/sourcing/Sourcing nvm.sh with --install and .nvmrc should install it +27 -0
- package/test/sourcing/Sourcing nvm.sh with --install should install the default +32 -0
- package/test/sourcing/Sourcing nvm.sh with --no-use should not use anything +31 -0
- package/test/sourcing/Sourcing nvm.sh with no default should return 0 +11 -0
- package/test/sourcing/setup +14 -0
- package/test/sourcing/teardown +7 -0
- package/update_test_mocks.sh +59 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
die () { echo "$@" ; exit 1; }
|
4
|
+
|
5
|
+
\. ../../../nvm.sh
|
6
|
+
\. ../../common.sh
|
7
|
+
|
8
|
+
make_fake_node v0.12.34 || die 'fake v0.12.34 could not be made'
|
9
|
+
|
10
|
+
# Enable no unset variable
|
11
|
+
set -u
|
12
|
+
|
13
|
+
# Try an alias that does not exist
|
14
|
+
output=$(nvm ls 99 2>&1 1>/dev/null || true)
|
15
|
+
test -z "${output}" || die "1: expected empty; got >${output}"
|
16
|
+
|
17
|
+
# Try a version that does not exist
|
18
|
+
output=$(nvm ls 0.12.00 2>&1 1>/dev/null || true)
|
19
|
+
test -z "${output}" || die "2: expected empty; got >${output}"
|
20
|
+
|
21
|
+
# Try a version that does exist
|
22
|
+
output=$(nvm ls 0.12.34 2>&1 1>/dev/null || true)
|
23
|
+
test -z "${output}" || die "3: expected empty; got >${output}"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
\. ../../../nvm.sh
|
4
|
+
\. ../../common.sh
|
5
|
+
|
6
|
+
make_fake_node v0.0.1
|
7
|
+
make_fake_node v0.0.3
|
8
|
+
make_fake_node v0.0.9
|
9
|
+
make_fake_node v0.3.1
|
10
|
+
make_fake_node v0.3.3
|
11
|
+
make_fake_node v0.3.9
|
12
|
+
make_fake_node v0.12.87
|
13
|
+
make_fake_node v0.12.9
|
14
|
+
make_fake_iojs v0.1.2
|
15
|
+
make_fake_iojs v0.10.2
|
16
|
+
|
17
|
+
set -e
|
18
|
+
|
19
|
+
IFS='' nvm ls
|
@@ -0,0 +1,16 @@
|
|
1
|
+
rm -rf ../../../v0.0.1
|
2
|
+
rm -rf ../../../v0.0.2
|
3
|
+
rm -rf ../../../v0.0.3
|
4
|
+
rm -rf ../../../v0.0.9
|
5
|
+
rm -rf ../../../v0.0.20
|
6
|
+
rm -rf ../../../v0.1.2
|
7
|
+
rm -rf ../../../v0.1.3
|
8
|
+
rm -rf ../../../v0.1.4
|
9
|
+
rm -rf ../../../v0.2.3
|
10
|
+
rm -rf ../../../v0.3.1
|
11
|
+
rm -rf ../../../v0.3.3
|
12
|
+
rm -rf ../../../v0.3.9
|
13
|
+
rm -rf ../../../v0.20.3
|
14
|
+
rm -rf ../../../versions
|
15
|
+
rm -f ../../../alias/stable
|
16
|
+
rm -f ../../../alias/unstable
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
die () { echo "$@" ; exit 1; }
|
6
|
+
|
7
|
+
\. ../../nvm.sh
|
8
|
+
\. ../common.sh
|
9
|
+
|
10
|
+
make_fake_node v0.2.3
|
11
|
+
|
12
|
+
[ `expr $PATH : ".*v0.2.3/.*/bin.*"` = 0 ] || echo "WARNING: Unexpectedly found v0.2.3 already active" >&2
|
13
|
+
|
14
|
+
nvm use --delete-prefix v0.2.3 || die "Failed to activate v0.2.3"
|
15
|
+
[ `expr "$PATH" : ".*v0.2.3/.*/bin.*"` != 0 ] || die "PATH not set up properly"
|
16
|
+
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules.*"` = 0 ] || die "NODE_PATH should not contain (npm root -g)"
|
17
|
+
# ^ note: NODE_PATH should not contain `npm root -g` since globals should not be requireable
|
18
|
+
[ `expr "$NVM_BIN" : ".*v0.2.3/bin"` != 0 ] || die "NODE_BIN should contain bin directory path"
|
19
|
+
|
20
|
+
nvm deactivate || die "Failed to deactivate v0.2.3"
|
21
|
+
[ `expr "$PATH" : ".*v0.2.3/.*/bin.*"` = 0 ] || die "PATH not cleaned properly"
|
22
|
+
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules.*"` = 0 ] || die "NODE_PATH not cleaned properly"
|
23
|
+
[ "_$NVM_BIN" = "_" ] || die "NVM_BIN should be unset: got '$NVM_BIN'"
|
package/test/fast/Running 'nvm install' with '--reinstall-packages-from' requires a valid version
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
die () { echo "$@" ; cleanup ; exit 1; }
|
6
|
+
cleanup () {
|
7
|
+
rm -rf "${NVM_DIR}/v0.10.4"
|
8
|
+
}
|
9
|
+
|
10
|
+
\. ../../nvm.sh
|
11
|
+
\. ../common.sh
|
12
|
+
|
13
|
+
make_fake_node v0.10.4
|
14
|
+
|
15
|
+
nvm deactivate >/dev/null 2>&1
|
16
|
+
|
17
|
+
set +ex # needed for stderr
|
18
|
+
INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from=0.11 2>&1)"
|
19
|
+
set -ex
|
20
|
+
EXPECTED_ERROR_MSG="If --reinstall-packages-from is provided, it must point to an installed version of node."
|
21
|
+
[ "~$INSTALL_ERROR_MSG" = "~$EXPECTED_ERROR_MSG" ] \
|
22
|
+
|| die ""nvm install --reinstall-packages-from" should fail when given an uninstalled version: expected '$EXPECTED_ERROR_MSG', got '$INSTALL_ERROR_MSG'"
|
23
|
+
|
24
|
+
set +e # TODO: fix
|
25
|
+
INSTALL_EXIT_CODE="$(nvm install v0.10.5 --reinstall-packages-from=0.11 >/dev/null 2>&1; echo $?)"
|
26
|
+
set -e
|
27
|
+
[ $INSTALL_EXIT_CODE -eq 5 ] \
|
28
|
+
|| die ""nvm install --reinstall-packages-from" should exit with code 5 when given an uninstalled version, got ${INSTALL_EXIT_CODE}"
|
29
|
+
|
30
|
+
set +ex # needed for stderr
|
31
|
+
INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from=0.10.5 2>&1)"
|
32
|
+
set -ex
|
33
|
+
EXPECTED_ERROR_MSG="You can't reinstall global packages from the same version of node you're installing."
|
34
|
+
[ "~$INSTALL_ERROR_MSG" = "~$EXPECTED_ERROR_MSG" ] \
|
35
|
+
|| die ""nvm install --reinstall-packages-from" should fail when given the same version: expected '$EXPECTED_ERROR_MSG', got '$INSTALL_ERROR_MSG'"
|
36
|
+
|
37
|
+
set +e # TODO: fix
|
38
|
+
INSTALL_EXIT_CODE="$(nvm install v0.10.5 --reinstall-packages-from=0.10.5 >/dev/null 2>&1; echo $?)"
|
39
|
+
set -e
|
40
|
+
[ $INSTALL_EXIT_CODE -eq 4 ] \
|
41
|
+
|| die ""nvm install --reinstall-packages-from" should exit with code 4 when given the same version, got $INSTALL_EXIT_CODE"
|
42
|
+
|
43
|
+
set +ex # needed for stderr
|
44
|
+
INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from 2>&1)"
|
45
|
+
set -ex
|
46
|
+
EXPECTED_ERROR_MSG='If --reinstall-packages-from is provided, it must point to an installed version of node using `=`.'
|
47
|
+
[ "~$INSTALL_ERROR_MSG" = "~$EXPECTED_ERROR_MSG" ] \
|
48
|
+
|| die ""nvm install --reinstall-packages-from" should fail when given an uninstalled version: expected '$EXPECTED_ERROR_MSG', got '$INSTALL_ERROR_MSG'"
|
49
|
+
|
50
|
+
set +ex # needed for stderr
|
51
|
+
INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from= 2>&1)"
|
52
|
+
set -ex
|
53
|
+
EXPECTED_ERROR_MSG="If --reinstall-packages-from is provided, it must point to an installed version of node."
|
54
|
+
[ "~$INSTALL_ERROR_MSG" = "~$EXPECTED_ERROR_MSG" ] \
|
55
|
+
|| die ""nvm install --reinstall-packages-from" should fail when given an uninstalled version: expected '$EXPECTED_ERROR_MSG', got '$INSTALL_ERROR_MSG'"
|
56
|
+
|
57
|
+
cleanup
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
die () { echo "$@" ; exit 1; }
|
6
|
+
|
7
|
+
\. ../../nvm.sh
|
8
|
+
|
9
|
+
set +ex # needed for stderr
|
10
|
+
OUTPUT="$(nvm install invalid.invalid 2>&1)"
|
11
|
+
set -ex
|
12
|
+
EXPECTED_OUTPUT="Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions."
|
13
|
+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "nvm installing an invalid version did not print a nice error message"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
\. ../../nvm.sh
|
6
|
+
\. ../common.sh
|
7
|
+
|
8
|
+
make_fake_node v0.0.1
|
9
|
+
sudo touch ""$(nvm_version_path v0.0.1)"/sudo"
|
10
|
+
|
11
|
+
RETURN_MESSAGE="$(nvm uninstall v0.0.1 2>&1 || echo)"
|
12
|
+
CHECK_FOR="Cannot uninstall, incorrect permissions on installation folder"
|
13
|
+
|
14
|
+
[ "${RETURN_MESSAGE#*$CHECK_FOR}" != "$RETURN_MESSAGE" ] || exit 1
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
BEFORE="./before.tmp"
|
6
|
+
AFTER="./after.tmp"
|
7
|
+
|
8
|
+
cleanup () { rm -f "${BEFORE}" "${AFTER}"; }
|
9
|
+
die () { echo "$@" ; cleanup ; exit 1; }
|
10
|
+
|
11
|
+
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${BEFORE}"
|
12
|
+
env | grep -v PATH= | grep -v IFS= | grep -v NVM_ | sort >> "${BEFORE}"
|
13
|
+
|
14
|
+
set +e # TODO: fix
|
15
|
+
\. ../../nvm.sh
|
16
|
+
set -e
|
17
|
+
|
18
|
+
type nvm > /dev/null 2>&1 || die "nvm not loaded"
|
19
|
+
|
20
|
+
nvm unload
|
21
|
+
|
22
|
+
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${AFTER}"
|
23
|
+
env | grep -v PATH= | grep -v IFS= | sort >> "${AFTER}"
|
24
|
+
|
25
|
+
! type nvm > /dev/null 2>&1 || die "nvm not unloaded"
|
26
|
+
|
27
|
+
DIFF="$(diff "${BEFORE}" "${AFTER}" ||:)"
|
28
|
+
[ -z "${DIFF}" ] || die "function pollution found: ${DIFF}"
|
29
|
+
|
30
|
+
cleanup
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
die () { echo "$@" ; cleanup ; exit 1; }
|
6
|
+
|
7
|
+
cleanup() {
|
8
|
+
rm -rf "$(nvm_alias_path)/foo"
|
9
|
+
}
|
10
|
+
|
11
|
+
\. ../../nvm.sh
|
12
|
+
|
13
|
+
nvm_make_alias foo foo
|
14
|
+
|
15
|
+
set +ex # needed for stderr
|
16
|
+
OUTPUT="$(nvm use foo 2>&1)"
|
17
|
+
set -ex
|
18
|
+
EXPECTED_OUTPUT='The alias "foo" leads to an infinite loop. Aborting.'
|
19
|
+
[ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] \
|
20
|
+
|| die "'nvm use foo' did not output >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
21
|
+
|
22
|
+
set +ex # needed for stderr
|
23
|
+
EXIT_CODE="$(nvm use foo 2>/dev/null ; echo $?)"
|
24
|
+
set -ex
|
25
|
+
[ "_$EXIT_CODE" = "_8" ] || die "Expected exit code 8; got ${EXIT_CODE}"
|
26
|
+
|
27
|
+
set +ex # needed for stderr
|
28
|
+
OUTPUT="$(nvm use --silent foo 2>&1)"
|
29
|
+
set -ex
|
30
|
+
EXPECTED_OUTPUT=''
|
31
|
+
[ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] \
|
32
|
+
|| die "'nvm use --silent foo' did not output >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
33
|
+
|
34
|
+
set +ex # needed for stderr
|
35
|
+
EXIT_CODE="$(nvm use --silent foo 2>/dev/null ; echo $?)"
|
36
|
+
set -ex
|
37
|
+
[ $EXIT_CODE -eq 8 ] || die "Expected exit code 8 from 'nvm use --silent foo'; got ${EXIT_CODE}"
|
38
|
+
|
39
|
+
cleanup
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
\. ../common.sh
|
6
|
+
|
7
|
+
die () { echo "$@" ; cleanup ; exit 1; }
|
8
|
+
|
9
|
+
VERSION="v3.99.0"
|
10
|
+
|
11
|
+
cleanup() {
|
12
|
+
unset -f make_echo cleanup
|
13
|
+
rm -rf "$(nvm_version_path "iojs-${VERSION}")"
|
14
|
+
}
|
15
|
+
|
16
|
+
\. ../../nvm.sh
|
17
|
+
|
18
|
+
nvm deactivate || die "unable to deactivate; current: >$(nvm current)<"
|
19
|
+
|
20
|
+
make_fake_iojs "${VERSION}" || die "unable to make_fake_iojs ${VERSION}"
|
21
|
+
|
22
|
+
IOJS_VERSION="$(nvm_version iojs)"
|
23
|
+
[ -n "${IOJS_VERSION}" ] || die 'expected an io.js version; got none'
|
24
|
+
|
25
|
+
EXPECTED_OUTPUT="$(nvm_add_iojs_prefix ${VERSION})"
|
26
|
+
[ "${IOJS_VERSION}" = "${EXPECTED_OUTPUT}" ] || die "iojs version was not >${EXPECTED_OUTPUT}; got >${IOJS_VERSION}<"
|
27
|
+
|
28
|
+
nvm use --delete-prefix iojs || die '`nvm use iojs` failed'
|
29
|
+
|
30
|
+
# Remove node_modules/.bin from the path so that the system version `which` is
|
31
|
+
# used in nvm_ls_current
|
32
|
+
PATH=$(echo "$PATH" | tr ":" "\n" | grep -v "node_modules/.bin" | tr "\n" ":") CURRENT="$(nvm current)"
|
33
|
+
echo "current: ${CURRENT}"
|
34
|
+
|
35
|
+
[ "${CURRENT}" = "${IOJS_VERSION}" ] || die "expected >${IOJS_VERSION}<; got >${CURRENT}<"
|
36
|
+
|
37
|
+
cleanup
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -eux
|
4
|
+
|
5
|
+
cleanup() {
|
6
|
+
unset -f nvm_has_system_node nvm_print_npm_version
|
7
|
+
}
|
8
|
+
die() { echo "$@" ; cleanup ; exit 1; }
|
9
|
+
|
10
|
+
\. ../../nvm.sh
|
11
|
+
|
12
|
+
nvm_has_system_node() { return 0; }
|
13
|
+
nvm_print_npm_version() { command printf ' (npm v1.2.3)'; }
|
14
|
+
|
15
|
+
EXPECTED_OUTPUT="Now using system version of node: $(node -v)$(nvm_print_npm_version)"
|
16
|
+
set +x # since stderr is needed
|
17
|
+
OUTPUT="$(nvm use system 2>&1)"
|
18
|
+
set -x
|
19
|
+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "Could not use system version of node. Got >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
|
20
|
+
|
21
|
+
EXPECTED_OUTPUT=""
|
22
|
+
set +x # since stderr is needed
|
23
|
+
OUTPUT="$(nvm use --silent system 2>&1 | tail -1)"
|
24
|
+
set -x
|
25
|
+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "Could not use system version of node or --silent was not silent"
|
26
|
+
|
27
|
+
nvm_has_system_node() { return 1; }
|
28
|
+
nvm_print_npm_version() { command printf ''; }
|
29
|
+
|
30
|
+
EXPECTED_OUTPUT="System version of node not found."
|
31
|
+
set +x # since stderr is needed
|
32
|
+
OUTPUT="$(nvm use system 2>&1 | tail -1)"
|
33
|
+
set -x
|
34
|
+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "Did not report error, system node not found"
|
35
|
+
|
36
|
+
nvm use system 2>&1 > /dev/null || [ $? -eq 127 ] || die "Did not return error code, system node not found"
|
37
|
+
EXPECTED_OUTPUT=""
|
38
|
+
set +x # since stderr is needed
|
39
|
+
OUTPUT="$(nvm use --silent system 2>&1 | tail -1)"
|
40
|
+
set -x
|
41
|
+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "Did not report error, system node not found or --silent was not silent"
|
42
|
+
nvm use --silent system 2>&1 > /dev/null || [ $? -eq 127 ] || die "Did not return error code, system node not found or --silent was not silent"
|
43
|
+
|
44
|
+
cleanup
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
export NVM_SYMLINK_CURRENT=true
|
6
|
+
\. ../../nvm.sh
|
7
|
+
\. ../common.sh
|
8
|
+
|
9
|
+
rm -rf "${NVM_DIR}/v0.10.29"
|
10
|
+
make_fake_node v0.10.29
|
11
|
+
nvm use --delete-prefix 0.10.29
|
12
|
+
rm -rf "${NVM_DIR}/v0.10.29"
|
13
|
+
|
14
|
+
if [ ! -L "${NVM_DIR}/current" ];then
|
15
|
+
echo "Expected 'current' symlink to be created!"
|
16
|
+
exit 1
|
17
|
+
fi
|
18
|
+
|
19
|
+
oldLink="$(readlink "${NVM_DIR}/current")"
|
20
|
+
|
21
|
+
if [ "$(basename "${oldLink}")" != 'v0.10.29' ];then
|
22
|
+
echo "Expected 'current' to point to v0.10.29 but was ${oldLink}"
|
23
|
+
exit 1
|
24
|
+
fi
|
25
|
+
|
26
|
+
rm -rf "${NVM_DIR}/v0.11.13"
|
27
|
+
make_fake_node v0.11.13
|
28
|
+
nvm use --delete-prefix 0.11.13
|
29
|
+
rm -rf "${NVM_DIR}/v0.11.13"
|
30
|
+
|
31
|
+
newLink="$(readlink "${NVM_DIR}/current")"
|
32
|
+
|
33
|
+
if [ "$(basename "${newLink}")" != 'v0.11.13' ];then
|
34
|
+
echo "Expected 'current' to point to v0.11.13 but was $newLink"
|
35
|
+
exit 1
|
36
|
+
fi
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
\. ../../nvm.sh
|
6
|
+
\. ../common.sh
|
7
|
+
|
8
|
+
TEST_NODE_VERSION="v0.10.29"
|
9
|
+
|
10
|
+
TEST_COUNT=0
|
11
|
+
TEST_PASSED=0
|
12
|
+
TEST_FAILED=0
|
13
|
+
|
14
|
+
registerExpectedSymlink() {
|
15
|
+
registerResult ${1}
|
16
|
+
}
|
17
|
+
|
18
|
+
registerExpectedNoSymlink() {
|
19
|
+
[ $1 -ne 0 ]
|
20
|
+
registerResult $?
|
21
|
+
}
|
22
|
+
|
23
|
+
registerResult() {
|
24
|
+
result="${1}"
|
25
|
+
|
26
|
+
TEST_COUNT=$(($TEST_COUNT + 1))
|
27
|
+
|
28
|
+
[ ${result} -eq 0 ] \
|
29
|
+
&& TEST_PASSED=$(($TEST_PASSED + 1)) \
|
30
|
+
|| TEST_FAILED=$(($TEST_FAILED + 1))
|
31
|
+
}
|
32
|
+
|
33
|
+
cleanup() {
|
34
|
+
rm -rf "${NVM_DIR}/${TEST_NODE_VERSION}"
|
35
|
+
rm -f "${NVM_DIR}/current"
|
36
|
+
}
|
37
|
+
|
38
|
+
runNvmUse() {
|
39
|
+
make_fake_node "$TEST_NODE_VERSION"
|
40
|
+
nvm use --delete-prefix "${TEST_NODE_VERSION}" > /dev/null 2>&1
|
41
|
+
rm -rf "${NVM_DIR}/${TEST_NODE_VERSION}"
|
42
|
+
}
|
43
|
+
|
44
|
+
isCurrentSymlinkPresent() {
|
45
|
+
[ -L "${NVM_DIR}/current" ]
|
46
|
+
}
|
47
|
+
|
48
|
+
NVM_SYMLINK_CURRENT=false
|
49
|
+
cleanup
|
50
|
+
runNvmUse
|
51
|
+
isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=false!"
|
52
|
+
registerExpectedNoSymlink $?
|
53
|
+
|
54
|
+
NVM_SYMLINK_CURRENT=true
|
55
|
+
cleanup
|
56
|
+
runNvmUse
|
57
|
+
isCurrentSymlinkPresent || echo >&2 "Expected 'current' symlink to be created when NVM_SYMLINK_CURRENT=true!"
|
58
|
+
registerExpectedSymlink $?
|
59
|
+
|
60
|
+
NVM_SYMLINK_CURRENT=garbagevalue
|
61
|
+
cleanup
|
62
|
+
runNvmUse
|
63
|
+
isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT contains a string!"
|
64
|
+
registerExpectedNoSymlink $?
|
65
|
+
|
66
|
+
NVM_SYMLINK_CURRENT=0
|
67
|
+
cleanup
|
68
|
+
runNvmUse
|
69
|
+
isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=0!"
|
70
|
+
registerExpectedNoSymlink $?
|
71
|
+
|
72
|
+
NVM_SYMLINK_CURRENT=1
|
73
|
+
cleanup
|
74
|
+
runNvmUse
|
75
|
+
isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT=1!"
|
76
|
+
registerExpectedNoSymlink $?
|
77
|
+
|
78
|
+
unset NVM_SYMLINK_CURRENT
|
79
|
+
cleanup
|
80
|
+
runNvmUse
|
81
|
+
isCurrentSymlinkPresent && echo >&2 "Expected 'current' symlink not to be created when NVM_SYMLINK_CURRENT has been unset (default behaviour)!"
|
82
|
+
registerExpectedNoSymlink $?
|
83
|
+
|
84
|
+
cleanup
|
85
|
+
|
86
|
+
[ $TEST_FAILED -ne 0 ] && echo "${TEST_COUNT} tested, ${TEST_PASSED} passed, ${TEST_FAILED} failed" && exit 1 || true
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
die () { echo "$@" ; cleanup ; exit 1; }
|
6
|
+
|
7
|
+
cleanup() {
|
8
|
+
unset VERSION1 VERSION2 VERSION3
|
9
|
+
rm .nvmrc
|
10
|
+
}
|
11
|
+
|
12
|
+
\. ../../nvm.sh
|
13
|
+
|
14
|
+
# normal .nvmrc
|
15
|
+
printf '0.999.0\n' > .nvmrc
|
16
|
+
nvm_rc_version
|
17
|
+
VERSION1="${NVM_RC_VERSION}"
|
18
|
+
|
19
|
+
# .nvmrc with CR char
|
20
|
+
printf '0.999.0\r\n' > .nvmrc
|
21
|
+
nvm_rc_version
|
22
|
+
VERSION2="${NVM_RC_VERSION}"
|
23
|
+
|
24
|
+
[ "${VERSION1}" = "${VERSION2}" ]
|
25
|
+
|
26
|
+
# .nvmrc without any newline char
|
27
|
+
printf '0.999.0' > .nvmrc
|
28
|
+
nvm_rc_version
|
29
|
+
VERSION3="${NVM_RC_VERSION}"
|
30
|
+
|
31
|
+
[ "${VERSION1}" = "${VERSION3}" ]
|
32
|
+
|
33
|
+
cleanup
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
die () {
|
6
|
+
echo "Expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
7
|
+
exit 1
|
8
|
+
}
|
9
|
+
|
10
|
+
cleanup() {
|
11
|
+
echo "Tested nvm_echo_with_colors"
|
12
|
+
}
|
13
|
+
|
14
|
+
\. ../../../nvm.sh
|
15
|
+
|
16
|
+
OUTPUT="$(nvm_echo_with_colors "\033[0;36mCyan-colored text")"
|
17
|
+
EXPECTED_OUTPUT=$(printf "\033[0;36mCyan-colored text")
|
18
|
+
|
19
|
+
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die
|
20
|
+
|
21
|
+
cleanup
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -ex
|
4
|
+
|
5
|
+
die () { echo "$@" ; cleanup ; exit 1; }
|
6
|
+
|
7
|
+
cleanup() {
|
8
|
+
echo "Tested nvm_err_with_colors"
|
9
|
+
}
|
10
|
+
|
11
|
+
\. ../../../nvm.sh
|
12
|
+
|
13
|
+
set +ex
|
14
|
+
OUTPUT="$(nvm_err_with_colors "\033[0;35mMagenta-colored text" 2>&1)"
|
15
|
+
set -ex
|
16
|
+
EXPECTED_OUTPUT=$(printf "\033[0;35mMagenta-colored text")
|
17
|
+
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die
|
18
|
+
|
19
|
+
cleanup
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
\. ../../../nvm.sh
|
4
|
+
|
5
|
+
die () {
|
6
|
+
# echo "$@" ;
|
7
|
+
echo "Expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
8
|
+
exit 1
|
9
|
+
}
|
10
|
+
|
11
|
+
set -e
|
12
|
+
|
13
|
+
nvm_get_colors(){
|
14
|
+
echo "0;95m"
|
15
|
+
}
|
16
|
+
|
17
|
+
# nvm_print_default_alias call nvm_print_formatted_alias which calls nvm_get-colors
|
18
|
+
# the output of nvm_print_default_alias uses the color code returned by nvm_get_colors (redefined above)
|
19
|
+
OUTPUT=$(command printf %b $(nvm_print_default_alias node ./alias v14.7.0) | awk '{ print substr($0, 1, 11); }')
|
20
|
+
EXPECTED_OUTPUT=$(command printf %b "\033[0;95mnode")
|
21
|
+
|
22
|
+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die
|
23
|
+
|
24
|
+
set +e
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
\. ../../../nvm.sh
|
4
|
+
|
5
|
+
set -e
|
6
|
+
|
7
|
+
die () {
|
8
|
+
# echo "$@" ;
|
9
|
+
echo "Expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
10
|
+
exit 1
|
11
|
+
}
|
12
|
+
cleanup() {
|
13
|
+
if [ -n TEMP_NVM_COLORS ]; then
|
14
|
+
export NVM_COLORS=TEMP_NVM_COLORS
|
15
|
+
fi
|
16
|
+
unset TEMP_NVM_COLORS
|
17
|
+
}
|
18
|
+
|
19
|
+
if [ -n ${NVM_COLORS} ]; then
|
20
|
+
export TEMP_NVM_COLORS=NVM_COLORS
|
21
|
+
unset NVM_COLORS
|
22
|
+
fi
|
23
|
+
|
24
|
+
# default system color
|
25
|
+
nvm use system
|
26
|
+
OUTPUT=$(nvm_print_versions system)
|
27
|
+
FORMAT="\033[0;32m-> %12s\033[0m"
|
28
|
+
VERSION='system'
|
29
|
+
EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")
|
30
|
+
|
31
|
+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die
|
32
|
+
|
33
|
+
nvm_ls_current() { echo "current";}
|
34
|
+
|
35
|
+
# default current color
|
36
|
+
OUTPUT=$(nvm_print_versions current)
|
37
|
+
FORMAT="\033[0;32m-> %12s\033[0m"
|
38
|
+
VERSION="current"
|
39
|
+
EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")
|
40
|
+
|
41
|
+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die
|
42
|
+
|
43
|
+
# custom current color
|
44
|
+
nvm set-colors YCMGR
|
45
|
+
OUTPUT=$(nvm_print_versions current)
|
46
|
+
FORMAT="\033[1;35m-> %12s\033[0m"
|
47
|
+
VERSION="current"
|
48
|
+
EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")
|
49
|
+
|
50
|
+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die
|
51
|
+
|
52
|
+
cleanup
|