Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-08-11 02:39:06 +0400
committerisaacs <i@izs.me>2010-08-11 02:39:19 +0400
commit1abffba9b5fb80bcfe3ea6ce91cad822fa6fa2ef (patch)
tree10f5f4c72d6a19d9897d65cff9aea30a137ae3a8 /test
parent6f7987bb40910cb651f9f2cd3d020bfb5e602db1 (diff)
More tests
Diffstat (limited to 'test')
-rw-r--r--test/packages/blerg/package.json5
-rw-r--r--test/packages/failer/package.json5
-rwxr-xr-xtest/update-test.sh59
3 files changed, 69 insertions, 0 deletions
diff --git a/test/packages/blerg/package.json b/test/packages/blerg/package.json
new file mode 100644
index 000000000..945b5360f
--- /dev/null
+++ b/test/packages/blerg/package.json
@@ -0,0 +1,5 @@
+{ "name" : "blerg"
+, "version" : "0.0.0"
+, "dependencies":{"base64" :"*", "websocket-server":"*", "vows":"*"}
+, "scripts" : { "preinstall" : "echo [$npm_config_password] ; echo [$npm_config__password]" }
+}
diff --git a/test/packages/failer/package.json b/test/packages/failer/package.json
new file mode 100644
index 000000000..0ffc2bb3a
--- /dev/null
+++ b/test/packages/failer/package.json
@@ -0,0 +1,5 @@
+{ "name" : "failer"
+, "version" : "9999.999.99"
+, "dependencies" : { "base64" : "*" }
+, "scripts" : { "preinstall" : "exit 1" }
+} \ No newline at end of file
diff --git a/test/update-test.sh b/test/update-test.sh
new file mode 100755
index 000000000..f72c90dd9
--- /dev/null
+++ b/test/update-test.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+SELF_PATH="$0"
+if [ "${SELF_PATH:0:1}" != "." ] && [ "${SELF_PATH:0:1}" != "/" ]; then
+ SELF_PATH=./"$SELF_PATH"
+fi
+SELF_PATH=$( cd -P -- "$(dirname -- "$SELF_PATH")" \
+ && pwd -P \
+ ) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
+
+# resolve symlinks
+while [ -h "$SELF_PATH" ]; do
+ DIR=$(dirname -- "$SELF_PATH")
+ SYM=$(readlink -- "$SELF_PATH")
+ SELF_PATH=$( cd -- "$DIR" \
+ && cd -- $(dirname -- "$SYM") \
+ && pwd \
+ )/$(basename -- "$SYM")
+done
+DIR=$( dirname -- "$SELF_PATH" )
+
+export npm_config_root=$DIR/root
+export npm_config_binroot=$DIR/bin
+
+rm -rf $DIR/{root,bin}
+mkdir -p $DIR/root
+mkdir -p $DIR/bin
+npm ls installed 2>/dev/null | grep -v npm | awk '{print $1}' | xargs npm rm &>/dev/null
+npm install \
+ base64@1.0.0 \
+ eyes@0.1.1 \
+ vows@0.2.5 \
+ websocket-server@1.0.5 &>/dev/null
+npm install ./test/packages/blerg &>/dev/null
+npm install vows@0.3.0 &>/dev/null
+
+echo ""
+echo "##"
+echo "## starting update"
+echo "##"
+echo ""
+
+npm update
+
+echo ""
+echo "##"
+echo "## update done, all should be 'latest'"
+echo "##"
+echo ""
+
+list=$( npm ls installed remote 2>/dev/null )
+echo "$list"
+notlatest=$( echo "$list" | grep -v latest )
+if [ "$notlatest" != "" ]; then
+ echo "Failed: not latest"
+ echo $notlatest
+else
+ echo "ok"
+fi