mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	Tests for nvm copy-packages
				
					
				
			This commit is contained in:
		
							
								
								
									
										10
									
								
								test/slow/nvm copy-packages/setup_dir
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										10
									
								
								test/slow/nvm copy-packages/setup_dir
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | . ../../../nvm.sh | ||||||
|  | nvm install 0.10.28 | ||||||
|  | nvm install 0.10.29 | ||||||
|  |  | ||||||
|  | if [ -f ".nvmrc" ]; then | ||||||
|  |   mv .nvmrc .nvmrc.bak | ||||||
|  | fi | ||||||
|  |  | ||||||
							
								
								
									
										21
									
								
								test/slow/nvm copy-packages/should work as expected
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										21
									
								
								test/slow/nvm copy-packages/should work as expected
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | die () { echo "$@" ; exit 1; } | ||||||
|  |  | ||||||
|  | . ../../../nvm.sh | ||||||
|  |  | ||||||
|  | nvm use 0.10.28 | ||||||
|  |  | ||||||
|  | EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp npm recursive-blame uglify-js yo" | ||||||
|  |  | ||||||
|  | npm install -g --quiet $EXPECTED_PACKAGES | ||||||
|  |  | ||||||
|  | nvm use 0.10.29 | ||||||
|  | ORIGINAL_PACKAGES=$(npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | grep -o -e '/[^/]*$' | cut -c 2- | sort | uniq | xargs) | ||||||
|  |  | ||||||
|  | nvm copy-packages 0.10.28 | ||||||
|  | FINAL_PACKAGES=$(npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | grep -o -e '/[^/]*$' | cut -c 2- | sort | uniq | xargs) | ||||||
|  |  | ||||||
|  | [ "$FINAL_PACKAGES" = "$EXPECTED_PACKAGES" ] || die "final packages ($FINAL_PACKAGES) did not match expected packages ($EXPECTED_PACKAGES)" | ||||||
|  | [ "$ORIGINAL_PACKAGES" != "$FINAL_PACKAGES" ] || die "original packages matched final packages ($ORIGINAL_PACKAGES)" | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								test/slow/nvm copy-packages/teardown_dir
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								test/slow/nvm copy-packages/teardown_dir
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | . ../../../nvm.sh | ||||||
|  | nvm uninstall v0.10.28 | ||||||
|  | nvm uninstall v0.10.29 | ||||||
|  |  | ||||||
|  | rm -f .nvmrc | ||||||
|  |  | ||||||
|  | if [ -f ".nvmrc.bak" ]; then | ||||||
|  |   mv .nvmrc.bak .nvmrc | ||||||
|  | fi | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user