Browse Source

[Tests] update to latest npm in this test

Jordan Harband 7 years ago
parent
commit
71032cfaa1
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
  1. 2
      test/slow/nvm reinstall-packages/Running "nvm copy-packages $(nvm ls current)" should error out
  2. 10
      test/slow/nvm reinstall-packages/should work as expected

2
test/slow/nvm reinstall-packages/Running "nvm copy-packages $(nvm ls current)" should error out

@ -6,6 +6,8 @@ die () { echo "$@" ; exit 1; }
nvm use 0.10.28 > /dev/null nvm use 0.10.28 > /dev/null
nvm install-latest-npm || die 'nvm install-latest-npm failed'
EXPECTED_MSG="Can not reinstall packages from the current version of node." EXPECTED_MSG="Can not reinstall packages from the current version of node."
ACTUAL_MSG="$(nvm reinstall-packages 0.10.28 2>&1 > /dev/null)" ACTUAL_MSG="$(nvm reinstall-packages 0.10.28 2>&1 > /dev/null)"
[ "~$ACTUAL_MSG" = "~$EXPECTED_MSG" ] || die "'nvm use 0.10.28 && nvm reinstall-packages 0.10.28' did not fail with the right message: '$ACTUAL_MESSAGE'" [ "~$ACTUAL_MSG" = "~$EXPECTED_MSG" ] || die "'nvm use 0.10.28 && nvm reinstall-packages 0.10.28' did not fail with the right message: '$ACTUAL_MESSAGE'"

10
test/slow/nvm reinstall-packages/should work as expected

@ -4,15 +4,15 @@ die () { echo "$@" ; exit 1; }
\. ../../../nvm.sh \. ../../../nvm.sh
nvm exec 0.10.28 npm install -g npm@~1.4.11 # this is required because before 1.4.10, npm ls doesn't indicated linked packages nvm exec 0.10.28 npm install -g npm@~1.4.11 && nvm install-latest-npm # this is required because before 1.4.10, npm ls doesn't indicated linked packages
nvm exec 0.10.29 npm install -g npm@~1.4.11 # this is required because before 1.4.10, npm ls doesn't indicated linked packages nvm exec 0.10.29 npm install -g npm@~1.4.11 && nvm install-latest-npm # this is required because before 1.4.10, npm ls doesn't indicated linked packages
nvm use 0.10.28 nvm use 0.10.28
(cd test-npmlink && npm link) (cd test-npmlink && npm link)
EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp npmlist recursive-blame spawn-sync test-npmlink uglify-js yo" EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp npmlist recursive-blame spawn-sync test-npmlink uglify-js"
echo "$EXPECTED_PACKAGES" | sed -e 's/test-npmlink //' | xargs npm install -g --quiet echo "$EXPECTED_PACKAGES yo@1" | sed -e 's/test-npmlink //' | xargs npm install -g --quiet
get_packages() { get_packages() {
npm list -g --depth=0 | \sed -e '1 d' -e 's/^.* \(.*\)@.*/\1/' -e '/^npm$/ d' | xargs npm list -g --depth=0 | \sed -e '1 d' -e 's/^.* \(.*\)@.*/\1/' -e '/^npm$/ d' | xargs
@ -24,7 +24,7 @@ ORIGINAL_PACKAGES=$(get_packages)
nvm reinstall-packages 0.10.28 nvm reinstall-packages 0.10.28
FINAL_PACKAGES=$(get_packages) FINAL_PACKAGES=$(get_packages)
[ "$FINAL_PACKAGES" = "$EXPECTED_PACKAGES" ] || die "final packages ($FINAL_PACKAGES) did not match expected packages ($EXPECTED_PACKAGES)" [ "$FINAL_PACKAGES" = "$EXPECTED_PACKAGES yo" ] || die "final packages ($FINAL_PACKAGES) did not match expected packages ($EXPECTED_PACKAGES)"
[ "$ORIGINAL_PACKAGES" != "$FINAL_PACKAGES" ] || die "original packages matched final packages ($ORIGINAL_PACKAGES)" [ "$ORIGINAL_PACKAGES" != "$FINAL_PACKAGES" ] || die "original packages matched final packages ($ORIGINAL_PACKAGES)"
[ $(test-npmlink) = 'ok' ] || die "failed to run test-npmlink" [ $(test-npmlink) = 'ok' ] || die "failed to run test-npmlink"

Loading…
Cancel
Save