mirror of
				https://github.com/lukechilds/zsh-nvm.git
				synced 2025-10-30 14:46:28 +08:00 
			
		
		
		
	Add failing test for auto and lazy
See https://github.com/lukechilds/zsh-nvm/pull/55
This commit is contained in:
		
							parent
							
								
									9ae1115e76
								
							
						
					
					
						commit
						6557d7e2ed
					
				
							
								
								
									
										39
									
								
								tests/options/NVM_AUTO_USE && NVM_LAZY_LOAD
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										39
									
								
								tests/options/NVM_AUTO_USE && NVM_LAZY_LOAD
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,39 @@ | ||||
| #!/bin/sh | ||||
| source ../common.sh | ||||
| 
 | ||||
| # Node.js version to install | ||||
| node_version=v5.11.0 | ||||
| 
 | ||||
| # Load zsh-nvm and install Node.js in subshell | ||||
| (load_zsh_nvm && nvm install "$node_version" && [[ "$(node --version)" == "$node_version" ]]) || die "node wasn't installed" | ||||
| 
 | ||||
| # Check node isn't available | ||||
| [[ "$(node --version)" != "$node_version" ]] || die "node shouldn't be available $(node --version)" | ||||
| 
 | ||||
| # Setup .nvmrc dir | ||||
| local nvmrc_dir="$test_dir/nvmrc2" | ||||
| local no_nvmrc_dir="$test_dir/no-nvmrc2" | ||||
| local nvmrc="$nvmrc_dir/.nvmrc" | ||||
| mkdir "$no_nvmrc_dir" | ||||
| mkdir "$nvmrc_dir" | ||||
| touch "$nvmrc" | ||||
| 
 | ||||
| # Set NVM_LAZY_LOAD to true | ||||
| export NVM_LAZY_LOAD=true | ||||
| export NVM_AUTO_USE=true | ||||
| 
 | ||||
| # Load zsh-nvm | ||||
| load_zsh_nvm | ||||
| 
 | ||||
| # Check nvm is a lazy load function | ||||
| [[ $(which nvm) == *"_zsh_nvm_load"* ]] || die "nvm should be a lazy load function" | ||||
| 
 | ||||
| # Check node is a lazy load function | ||||
| [[ $(command -v node) == "node" ]] || die "node should be a shell function" | ||||
| 
 | ||||
| # Check npm is a lazy load function | ||||
| [[ $(command -v npm) == "npm" ]] || die "npm should be a shell function" | ||||
| 
 | ||||
| # Check cd into folder with .nvmrc keeps v6 | ||||
| echo 6 > "$nvmrc" | ||||
| (cd "$nvmrc_dir" && [[ "$(node --version | tail -1)" == "v6."* ]]) || die "Didn't switch to node 6" | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Amir Tahvildaran
						Amir Tahvildaran