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-12-30 00:55:01 +0300
committerisaacs <i@izs.me>2010-12-30 00:55:01 +0300
commit901ed145156a50ba61e0332d7ccb8bffe2fd4a93 (patch)
tree9c2b73a6074008cdc41e778e133254476c8d0065 /test
parent19097405b0c0a344a3e42b7ebb41665c563f5bff (diff)
A test of the package configuration stuff
Diffstat (limited to 'test')
-rw-r--r--test/packages/package-config/package.json4
-rwxr-xr-xtest/packages/package-config/test.js17
-rwxr-xr-xtest/run.sh8
3 files changed, 29 insertions, 0 deletions
diff --git a/test/packages/package-config/package.json b/test/packages/package-config/package.json
new file mode 100644
index 000000000..7ec97d380
--- /dev/null
+++ b/test/packages/package-config/package.json
@@ -0,0 +1,4 @@
+{"name":"package-config"
+,"version":"1.2.3"
+,"config":{"foo":"bar"}
+,"scripts":{"test":"./test.js"}}
diff --git a/test/packages/package-config/test.js b/test/packages/package-config/test.js
new file mode 100755
index 000000000..7337b237b
--- /dev/null
+++ b/test/packages/package-config/test.js
@@ -0,0 +1,17 @@
+#!/usr/bin/env node
+
+var env = process.env
+ , orig = require(process.env.npm_package_name+"/package.json").config
+ , assert = require("assert")
+
+console.log("Before running this test, do:\n"
+ +" npm config set package-config:foo boo\n"
+ +"or else it's about to fail.")
+assert.equal(env.npm_package_config_foo, "boo", "foo != boo")
+assert.equal(orig.foo, "bar", "original foo != bar")
+assert.equal(env["npm_config_package-config:foo"], "boo",
+ "package-config:foo != boo")
+console.log({ foo: env.npm_package_config_foo
+ , orig_foo: orig.foo
+ , "package-config:foo": env["npm_config_package-config:foo"]
+ })
diff --git a/test/run.sh b/test/run.sh
index a240ac94d..7eaaf7fbf 100755
--- a/test/run.sh
+++ b/test/run.sh
@@ -15,6 +15,10 @@ main () {
# install
npm install "$NPMPKG" || exit 1
+
+ # used in test later
+ npm config set package-config:foo boo || exit 1
+
npm install $( ls packages | awk '{print "packages/" $1 }' ) || exit 1
(ls packages | while read pkg; do
npm test "$pkg"@"$(ls -- "$ROOTDIR"/.npm/"$pkg" | grep -v active)"
@@ -26,6 +30,10 @@ main () {
# link
npm install "$NPMPKG" || exit 1
+
+ # used in test later
+ npm config set package-config:foo boo || exit 1
+
(ls packages | awk '{print "packages/" $1 }' | while read pkg; do
npm link "$pkg"
done) || exit 1