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
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2016-01-27 02:16:04 +0300
committerRebecca Turner <me@re-becca.org>2016-02-19 00:24:37 +0300
commit083734631f9b11b17c08bca8ba8cb736a7b1e3fb (patch)
tree23d7e59e8e6fc3de9b164d0d07a47cf0072b3d66
parent07f020a09e94ae393c67526985444e128ef6f83c (diff)
test: Port legacy tests to tap
This removes all the relatively cryptic legacy tests and creates new tap tests that check the same functionality. Credit: @iarna Credit: @zkat PR-URL: https://github.com/npm/npm/pull/11292 Reviewed-By: @iarna Reviewed-By: @zkat Reviewed-By: @othiym23
-rw-r--r--.travis.yml2
-rw-r--r--package.json2
-rw-r--r--test/packages/npm-test-array-bin/README1
-rw-r--r--test/packages/npm-test-array-bin/bin/array-bin2
-rw-r--r--test/packages/npm-test-array-bin/package.json4
-rw-r--r--test/packages/npm-test-array-bin/test.js5
-rw-r--r--test/packages/npm-test-blerg/README1
-rw-r--r--test/packages/npm-test-blerg/package.json5
-rw-r--r--test/packages/npm-test-blerg/test.js4
-rw-r--r--test/packages/npm-test-blerg3/README1
-rw-r--r--test/packages/npm-test-blerg3/package.json5
-rw-r--r--test/packages/npm-test-blerg3/test.js4
-rw-r--r--test/packages/npm-test-bundled-git/README1
-rw-r--r--test/packages/npm-test-bundled-git/minimatch-expected.json28
-rw-r--r--test/packages/npm-test-bundled-git/package.json5
-rw-r--r--test/packages/npm-test-bundled-git/test.js6
-rw-r--r--test/packages/npm-test-dir-bin/README1
-rw-r--r--test/packages/npm-test-dir-bin/bin/dir-bin2
-rw-r--r--test/packages/npm-test-dir-bin/package.json4
-rw-r--r--test/packages/npm-test-dir-bin/test.js5
-rw-r--r--test/packages/npm-test-env-reader/README1
-rw-r--r--test/packages/npm-test-env-reader/package.json14
-rwxr-xr-xtest/packages/npm-test-env-reader/test.js9
-rw-r--r--test/packages/npm-test-files/.npmignore7
-rw-r--r--test/packages/npm-test-files/README1
-rw-r--r--test/packages/npm-test-files/ignore30
-rw-r--r--test/packages/npm-test-files/ignoredir1/a0
-rw-r--r--test/packages/npm-test-files/ignoredir2/a0
-rw-r--r--test/packages/npm-test-files/include40
-rw-r--r--test/packages/npm-test-files/package.json10
-rw-r--r--test/packages/npm-test-files/sub/ignore10
-rw-r--r--test/packages/npm-test-files/sub/ignore30
-rw-r--r--test/packages/npm-test-files/sub/include0
-rw-r--r--test/packages/npm-test-files/sub/include20
-rw-r--r--test/packages/npm-test-files/sub/include41
-rw-r--r--test/packages/npm-test-files/test.sh27
-rw-r--r--test/packages/npm-test-ignore-nested-nm/README1
-rw-r--r--test/packages/npm-test-ignore-nested-nm/lib/node_modules/foo1
-rw-r--r--test/packages/npm-test-ignore-nested-nm/package.json3
-rw-r--r--test/packages/npm-test-ignore-nested-nm/test.js2
-rw-r--r--test/packages/npm-test-ignore/.npmignore7
-rw-r--r--test/packages/npm-test-ignore/README1
-rw-r--r--test/packages/npm-test-ignore/ignore30
-rw-r--r--test/packages/npm-test-ignore/ignoredir1/a0
-rw-r--r--test/packages/npm-test-ignore/ignoredir2/a0
-rw-r--r--test/packages/npm-test-ignore/include40
-rw-r--r--test/packages/npm-test-ignore/package.json3
-rw-r--r--test/packages/npm-test-ignore/sub/ignore10
-rw-r--r--test/packages/npm-test-ignore/sub/ignore30
-rw-r--r--test/packages/npm-test-ignore/sub/include0
-rw-r--r--test/packages/npm-test-ignore/sub/include20
-rw-r--r--test/packages/npm-test-ignore/sub/include41
-rw-r--r--test/packages/npm-test-ignore/test.sh29
-rw-r--r--test/packages/npm-test-missing-bindir/README1
-rw-r--r--test/packages/npm-test-missing-bindir/package.json4
-rw-r--r--test/packages/npm-test-missing-bindir/test.js4
-rw-r--r--test/packages/npm-test-optional-deps/README1
-rw-r--r--test/packages/npm-test-optional-deps/package.json11
-rw-r--r--test/packages/npm-test-optional-deps/test.js9
-rw-r--r--test/packages/npm-test-platform-all/README1
-rw-r--r--test/packages/npm-test-platform-all/package.json5
-rw-r--r--test/packages/npm-test-platform/README1
-rw-r--r--test/packages/npm-test-platform/package.json5
-rw-r--r--test/packages/npm-test-private/README1
-rw-r--r--test/packages/npm-test-private/package.json4
-rw-r--r--test/packages/npm-test-shrinkwrap/README1
-rw-r--r--test/packages/npm-test-shrinkwrap/npm-shrinkwrap.json49
-rw-r--r--test/packages/npm-test-shrinkwrap/package.json13
-rw-r--r--test/packages/npm-test-shrinkwrap/test.js37
-rw-r--r--test/packages/npm-test-test-package/README1
-rw-r--r--test/packages/npm-test-test-package/package.json5
-rw-r--r--test/packages/npm-test-url-dep/README1
-rw-r--r--test/packages/npm-test-url-dep/package.json7
-rw-r--r--test/run.js194
-rw-r--r--test/tap/legacy-array-bin.js80
-rw-r--r--test/tap/legacy-bundled-git.js103
-rw-r--r--test/tap/legacy-dir-bin.js79
-rw-r--r--test/tap/legacy-env-reader.js87
-rw-r--r--test/tap/legacy-files.js131
-rw-r--r--test/tap/legacy-ignore-nested-nm.js64
-rw-r--r--test/tap/legacy-ignore.js125
-rw-r--r--test/tap/legacy-missing-bindir.js82
-rw-r--r--test/tap/legacy-optional-deps.js79
-rw-r--r--test/tap/legacy-platform-all.js73
-rw-r--r--test/tap/legacy-platform.js64
-rw-r--r--test/tap/legacy-private.js58
-rw-r--r--test/tap/legacy-shrinkwrap.js132
-rw-r--r--test/tap/legacy-test-package.js76
-rw-r--r--test/tap/legacy-url-dep.js61
89 files changed, 1295 insertions, 560 deletions
diff --git a/.travis.yml b/.travis.yml
index 07c64af85..02765e737 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,6 +13,6 @@ before_install:
- "node . install -g ."
- "mkdir -p /var/run/couchdb"
sudo: false
-script: "npm run-script test-all"
+script: "npm test"
notifications:
slack: npm-inc:kRqQjto7YbINqHPb1X6nS3g8
diff --git a/package.json b/package.json
index e630554ae..5372c6be5 100644
--- a/package.json
+++ b/package.json
@@ -208,8 +208,6 @@
"preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true",
"tap": "tap --timeout 240",
"test": "standard && npm run test-tap",
- "test-all": "standard && npm run test-legacy && npm run test-tap",
- "test-legacy": "node ./test/run.js",
"test-tap": "npm run tap -- \"test/tap/*.js\"",
"test-node": "\"$NODE\" ./test/run.js && \"$NODE\" \"node_modules/.bin/tap\" --timeout 240 \"test/tap/*.js\""
},
diff --git a/test/packages/npm-test-array-bin/README b/test/packages/npm-test-array-bin/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-array-bin/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-array-bin/bin/array-bin b/test/packages/npm-test-array-bin/bin/array-bin
deleted file mode 100644
index 9558516aa..000000000
--- a/test/packages/npm-test-array-bin/bin/array-bin
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-console.log('ok')
diff --git a/test/packages/npm-test-array-bin/package.json b/test/packages/npm-test-array-bin/package.json
deleted file mode 100644
index 45e22efc4..000000000
--- a/test/packages/npm-test-array-bin/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{ "name":"npm-test-array-bin"
-, "version":"1.2.5"
-, "bin": [ "bin/array-bin" ]
-, "scripts": { "test": "node test.js" } }
diff --git a/test/packages/npm-test-array-bin/test.js b/test/packages/npm-test-array-bin/test.js
deleted file mode 100644
index f7922dbc7..000000000
--- a/test/packages/npm-test-array-bin/test.js
+++ /dev/null
@@ -1,5 +0,0 @@
-require('child_process').exec('array-bin', { env: process.env },
- function (err) {
- if (err && err.code) throw new Error('exited badly with code = ' + err.code)
- }
-)
diff --git a/test/packages/npm-test-blerg/README b/test/packages/npm-test-blerg/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-blerg/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-blerg/package.json b/test/packages/npm-test-blerg/package.json
deleted file mode 100644
index 04e333891..000000000
--- a/test/packages/npm-test-blerg/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{ "name":"npm-test-blerg"
-, "version" : "0.0.2"
-, "scripts" : { "test" : "node test.js" }
-, "publishConfig": {"tag": "foo"}
-}
diff --git a/test/packages/npm-test-blerg/test.js b/test/packages/npm-test-blerg/test.js
deleted file mode 100644
index cc8d2da54..000000000
--- a/test/packages/npm-test-blerg/test.js
+++ /dev/null
@@ -1,4 +0,0 @@
-var assert = require('assert')
-assert.equal(undefined, process.env.npm_config__password, 'password exposed!')
-assert.equal(undefined, process.env.npm_config__auth, 'auth exposed!')
-assert.equal(undefined, process.env.npm_config__authCrypt, 'authCrypt exposed!')
diff --git a/test/packages/npm-test-blerg3/README b/test/packages/npm-test-blerg3/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-blerg3/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-blerg3/package.json b/test/packages/npm-test-blerg3/package.json
deleted file mode 100644
index 87b5bbb96..000000000
--- a/test/packages/npm-test-blerg3/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{ "name":"npm-test-blerg3"
-, "homepage": "https://github.com/npm/npm/issues/2658"
-, "version" : "0.0.0"
-, "scripts" : { "test" : "node test.js" }
-}
diff --git a/test/packages/npm-test-blerg3/test.js b/test/packages/npm-test-blerg3/test.js
deleted file mode 100644
index cc8d2da54..000000000
--- a/test/packages/npm-test-blerg3/test.js
+++ /dev/null
@@ -1,4 +0,0 @@
-var assert = require('assert')
-assert.equal(undefined, process.env.npm_config__password, 'password exposed!')
-assert.equal(undefined, process.env.npm_config__auth, 'auth exposed!')
-assert.equal(undefined, process.env.npm_config__authCrypt, 'authCrypt exposed!')
diff --git a/test/packages/npm-test-bundled-git/README b/test/packages/npm-test-bundled-git/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-bundled-git/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-bundled-git/minimatch-expected.json b/test/packages/npm-test-bundled-git/minimatch-expected.json
deleted file mode 100644
index 3cb08daaa..000000000
--- a/test/packages/npm-test-bundled-git/minimatch-expected.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "name": "minimatch",
- "description": "a glob matcher in javascript",
- "version": "0.2.1",
- "repository": {
- "type": "git",
- "url": "git://github.com/isaacs/minimatch.git"
- },
- "main": "minimatch.js",
- "scripts": {
- "test": "tap test"
- },
- "engines": {
- "node": "*"
- },
- "dependencies": {
- "lru-cache": "~1.0.5"
- },
- "devDependencies": {
- "tap": "~0.1.3"
- },
- "licenses" : [
- {
- "type" : "MIT",
- "url" : "http://github.com/isaacs/minimatch/raw/master/LICENSE"
- }
- ]
-}
diff --git a/test/packages/npm-test-bundled-git/package.json b/test/packages/npm-test-bundled-git/package.json
deleted file mode 100644
index 69e0eb7a8..000000000
--- a/test/packages/npm-test-bundled-git/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{"name":"npm-test-bundled-git"
-,"scripts":{"test":"node test.js"}
-,"version":"1.2.5"
-,"dependencies":{"glob":"git://github.com/isaacs/node-glob.git#npm-test"}
-,"bundledDependencies":["glob"]}
diff --git a/test/packages/npm-test-bundled-git/test.js b/test/packages/npm-test-bundled-git/test.js
deleted file mode 100644
index 1901ac448..000000000
--- a/test/packages/npm-test-bundled-git/test.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var a = require('./node_modules/glob/node_modules/minimatch/package.json')
-var e = require('./minimatch-expected.json')
-var assert = require('assert')
-Object.keys(e).forEach(function (key) {
- assert.deepEqual(a[key], e[key], "didn't get expected minimatch/package.json")
-})
diff --git a/test/packages/npm-test-dir-bin/README b/test/packages/npm-test-dir-bin/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-dir-bin/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-dir-bin/bin/dir-bin b/test/packages/npm-test-dir-bin/bin/dir-bin
deleted file mode 100644
index 9558516aa..000000000
--- a/test/packages/npm-test-dir-bin/bin/dir-bin
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-console.log('ok')
diff --git a/test/packages/npm-test-dir-bin/package.json b/test/packages/npm-test-dir-bin/package.json
deleted file mode 100644
index 1ea26323f..000000000
--- a/test/packages/npm-test-dir-bin/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{ "name":"npm-test-dir-bin"
-, "version":"1.2.5"
-, "directories": { "bin": "./bin" }
-, "scripts": { "test": "node test.js" } }
diff --git a/test/packages/npm-test-dir-bin/test.js b/test/packages/npm-test-dir-bin/test.js
deleted file mode 100644
index 1a397061f..000000000
--- a/test/packages/npm-test-dir-bin/test.js
+++ /dev/null
@@ -1,5 +0,0 @@
-require('child_process').exec('dir-bin', { stdio: 'pipe', env: process.env },
- function (err) {
- if (err && err.code) throw new Error('exited badly with code = ' + err.code)
- }
-)
diff --git a/test/packages/npm-test-env-reader/README b/test/packages/npm-test-env-reader/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-env-reader/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-env-reader/package.json b/test/packages/npm-test-env-reader/package.json
deleted file mode 100644
index 99d7fc930..000000000
--- a/test/packages/npm-test-env-reader/package.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{ "name":"npm-test-env-reader"
-, "version" : "1.2.3"
-, "scripts" :
- { "install" : "node test.js"
- , "preinstall" : "node test.js"
- , "preuninstall" : "node test.js"
- , "postuninstall" : "node test.js"
- , "test" : "node test.js"
- , "stop" : "node test.js"
- , "start" : "node test.js"
- , "restart" : "node test.js"
- , "foo" : "node test.js"
- }
-}
diff --git a/test/packages/npm-test-env-reader/test.js b/test/packages/npm-test-env-reader/test.js
deleted file mode 100755
index d6cb7893a..000000000
--- a/test/packages/npm-test-env-reader/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var envs = []
-for (var e in process.env) {
- if (e.match(/npm|^path$/i)) envs.push(e + '=' + process.env[e])
-}
-envs.sort(function (a, b) {
- return a === b ? 0 : a > b ? -1 : 1
-}).forEach(function (e) {
- console.log(e)
-})
diff --git a/test/packages/npm-test-files/.npmignore b/test/packages/npm-test-files/.npmignore
deleted file mode 100644
index c7d927d0a..000000000
--- a/test/packages/npm-test-files/.npmignore
+++ /dev/null
@@ -1,7 +0,0 @@
-/sub/ignore1
-./sub/include2
-ignore3
-./include4
-ignoredir1
-ignoredir2/
-*.tgz
diff --git a/test/packages/npm-test-files/README b/test/packages/npm-test-files/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-files/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-files/ignore3 b/test/packages/npm-test-files/ignore3
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-files/ignore3
+++ /dev/null
diff --git a/test/packages/npm-test-files/ignoredir1/a b/test/packages/npm-test-files/ignoredir1/a
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-files/ignoredir1/a
+++ /dev/null
diff --git a/test/packages/npm-test-files/ignoredir2/a b/test/packages/npm-test-files/ignoredir2/a
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-files/ignoredir2/a
+++ /dev/null
diff --git a/test/packages/npm-test-files/include4 b/test/packages/npm-test-files/include4
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-files/include4
+++ /dev/null
diff --git a/test/packages/npm-test-files/package.json b/test/packages/npm-test-files/package.json
deleted file mode 100644
index 2afa12dc5..000000000
--- a/test/packages/npm-test-files/package.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{ "name":"npm-test-files"
-, "version":"1.2.5"
-, "files":
- [ "include4"
- , "sub/include"
- , "sub/include2"
- , "sub/include4"
- , "test.sh"
- , ".npmignore" ]
-, "scripts":{"test":"bash test.sh"}}
diff --git a/test/packages/npm-test-files/sub/ignore1 b/test/packages/npm-test-files/sub/ignore1
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-files/sub/ignore1
+++ /dev/null
diff --git a/test/packages/npm-test-files/sub/ignore3 b/test/packages/npm-test-files/sub/ignore3
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-files/sub/ignore3
+++ /dev/null
diff --git a/test/packages/npm-test-files/sub/include b/test/packages/npm-test-files/sub/include
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-files/sub/include
+++ /dev/null
diff --git a/test/packages/npm-test-files/sub/include2 b/test/packages/npm-test-files/sub/include2
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-files/sub/include2
+++ /dev/null
diff --git a/test/packages/npm-test-files/sub/include4 b/test/packages/npm-test-files/sub/include4
deleted file mode 100644
index d16969cd1..000000000
--- a/test/packages/npm-test-files/sub/include4
+++ /dev/null
@@ -1 +0,0 @@
-This file should be in the package.
diff --git a/test/packages/npm-test-files/test.sh b/test/packages/npm-test-files/test.sh
deleted file mode 100644
index cdf47f211..000000000
--- a/test/packages/npm-test-files/test.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-x=`find . | grep ignore | grep -v npmignore`
-if [ "$x" != "" ]; then
- echo "ignored files included: $x"
- exit 1
-fi
-
-x=`find . | grep -v ignore | sort`
-y=".
-./include4
-./package.json
-./sub
-./sub/include
-./sub/include2
-./sub/include4
-./test.sh"
-if [ "$x" != "$y" ]; then
- echo "missing included files"
- echo "got:"
- echo "==="
- echo "$x"
- echo "==="
- echo "wanted:"
- echo "==="
- echo "$y"
- echo "==="
- exit 1
-fi
diff --git a/test/packages/npm-test-ignore-nested-nm/README b/test/packages/npm-test-ignore-nested-nm/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-ignore-nested-nm/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-ignore-nested-nm/lib/node_modules/foo b/test/packages/npm-test-ignore-nested-nm/lib/node_modules/foo
deleted file mode 100644
index 2c9d06aff..000000000
--- a/test/packages/npm-test-ignore-nested-nm/lib/node_modules/foo
+++ /dev/null
@@ -1 +0,0 @@
-I WILL NOT BE IGNORED!
diff --git a/test/packages/npm-test-ignore-nested-nm/package.json b/test/packages/npm-test-ignore-nested-nm/package.json
deleted file mode 100644
index 177dbfb01..000000000
--- a/test/packages/npm-test-ignore-nested-nm/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{"name":"npm-test-ignore-nested-nm"
-,"version":"1.2.5"
-,"scripts":{"test":"node test.js"}}
diff --git a/test/packages/npm-test-ignore-nested-nm/test.js b/test/packages/npm-test-ignore-nested-nm/test.js
deleted file mode 100644
index 18a0f0b56..000000000
--- a/test/packages/npm-test-ignore-nested-nm/test.js
+++ /dev/null
@@ -1,2 +0,0 @@
-var fs = require('fs')
-fs.statSync(__dirname + '/lib/node_modules/foo')
diff --git a/test/packages/npm-test-ignore/.npmignore b/test/packages/npm-test-ignore/.npmignore
deleted file mode 100644
index c7d927d0a..000000000
--- a/test/packages/npm-test-ignore/.npmignore
+++ /dev/null
@@ -1,7 +0,0 @@
-/sub/ignore1
-./sub/include2
-ignore3
-./include4
-ignoredir1
-ignoredir2/
-*.tgz
diff --git a/test/packages/npm-test-ignore/README b/test/packages/npm-test-ignore/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-ignore/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-ignore/ignore3 b/test/packages/npm-test-ignore/ignore3
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-ignore/ignore3
+++ /dev/null
diff --git a/test/packages/npm-test-ignore/ignoredir1/a b/test/packages/npm-test-ignore/ignoredir1/a
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-ignore/ignoredir1/a
+++ /dev/null
diff --git a/test/packages/npm-test-ignore/ignoredir2/a b/test/packages/npm-test-ignore/ignoredir2/a
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-ignore/ignoredir2/a
+++ /dev/null
diff --git a/test/packages/npm-test-ignore/include4 b/test/packages/npm-test-ignore/include4
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-ignore/include4
+++ /dev/null
diff --git a/test/packages/npm-test-ignore/package.json b/test/packages/npm-test-ignore/package.json
deleted file mode 100644
index 6d492de78..000000000
--- a/test/packages/npm-test-ignore/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{ "name":"npm-test-ignore"
-, "version":"1.2.5"
-, "scripts":{"test":"bash test.sh"}}
diff --git a/test/packages/npm-test-ignore/sub/ignore1 b/test/packages/npm-test-ignore/sub/ignore1
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-ignore/sub/ignore1
+++ /dev/null
diff --git a/test/packages/npm-test-ignore/sub/ignore3 b/test/packages/npm-test-ignore/sub/ignore3
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-ignore/sub/ignore3
+++ /dev/null
diff --git a/test/packages/npm-test-ignore/sub/include b/test/packages/npm-test-ignore/sub/include
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-ignore/sub/include
+++ /dev/null
diff --git a/test/packages/npm-test-ignore/sub/include2 b/test/packages/npm-test-ignore/sub/include2
deleted file mode 100644
index e69de29bb..000000000
--- a/test/packages/npm-test-ignore/sub/include2
+++ /dev/null
diff --git a/test/packages/npm-test-ignore/sub/include4 b/test/packages/npm-test-ignore/sub/include4
deleted file mode 100644
index d16969cd1..000000000
--- a/test/packages/npm-test-ignore/sub/include4
+++ /dev/null
@@ -1 +0,0 @@
-This file should be in the package.
diff --git a/test/packages/npm-test-ignore/test.sh b/test/packages/npm-test-ignore/test.sh
deleted file mode 100644
index 05fbaf169..000000000
--- a/test/packages/npm-test-ignore/test.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-x=`find . | grep ignore | grep -v npmignore`
-if [ "$x" != "" ]; then
- echo "ignored files included: $x"
- exit 1
-fi
-
-x=`find . | grep -v ignore | sort`
-y=".
-./include4
-./package.json
-./README
-./sub
-./sub/include
-./sub/include2
-./sub/include4
-./test.sh"
-y="`echo "$y" | sort`"
-if [ "$x" != "$y" ]; then
- echo "missing included files"
- echo "got:"
- echo "==="
- echo "$x"
- echo "==="
- echo "wanted:"
- echo "==="
- echo "$y"
- echo "==="
- exit 1
-fi
diff --git a/test/packages/npm-test-missing-bindir/README b/test/packages/npm-test-missing-bindir/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-missing-bindir/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-missing-bindir/package.json b/test/packages/npm-test-missing-bindir/package.json
deleted file mode 100644
index 49e26742d..000000000
--- a/test/packages/npm-test-missing-bindir/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{ "name":"npm-test-missing-bindir"
-, "version" : "0.0.0"
-, "scripts" : { "test" : "node test.js" }
-, "directories": { "bin" : "./not-found" } }
diff --git a/test/packages/npm-test-missing-bindir/test.js b/test/packages/npm-test-missing-bindir/test.js
deleted file mode 100644
index cc8d2da54..000000000
--- a/test/packages/npm-test-missing-bindir/test.js
+++ /dev/null
@@ -1,4 +0,0 @@
-var assert = require('assert')
-assert.equal(undefined, process.env.npm_config__password, 'password exposed!')
-assert.equal(undefined, process.env.npm_config__auth, 'auth exposed!')
-assert.equal(undefined, process.env.npm_config__authCrypt, 'authCrypt exposed!')
diff --git a/test/packages/npm-test-optional-deps/README b/test/packages/npm-test-optional-deps/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-optional-deps/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-optional-deps/package.json b/test/packages/npm-test-optional-deps/package.json
deleted file mode 100644
index 67545ca9d..000000000
--- a/test/packages/npm-test-optional-deps/package.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{ "name": "npm-test-optional-deps"
-, "version": "1.2.5"
-, "scripts": { "test": "node test.js" }
-, "optionalDependencies":
- { "npm-test-foobarzaaakakaka": "http://example.com/"
- , "dnode": "10.999.14234"
- , "sax": "0.3.5"
- , "glob": "some invalid version 99 #! $$ x y z"
- , "npm-test-failer":"*"
- }
-}
diff --git a/test/packages/npm-test-optional-deps/test.js b/test/packages/npm-test-optional-deps/test.js
deleted file mode 100644
index b9dc2c79b..000000000
--- a/test/packages/npm-test-optional-deps/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var fs = require('fs')
-var assert = require('assert')
-var path = require('path')
-
-// sax should be the only dep that ends up installed
-
-var dir = path.resolve(__dirname, 'node_modules')
-assert.deepEqual(fs.readdirSync(dir), ['sax'])
-assert.equal(require('sax/package.json').version, '0.3.5')
diff --git a/test/packages/npm-test-platform-all/README b/test/packages/npm-test-platform-all/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-platform-all/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-platform-all/package.json b/test/packages/npm-test-platform-all/package.json
deleted file mode 100644
index 07624363e..000000000
--- a/test/packages/npm-test-platform-all/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{"name":"npm-test-platform-all"
-,"version":"9.9.9-9"
-,"homepage":"http://www.zombo.com/"
-,"os":["darwin","linux","win32","solaris","haiku","sunos","freebsd","openbsd","netbsd"]
-,"cpu":["arm","mips","ia32","x64","sparc"]}
diff --git a/test/packages/npm-test-platform/README b/test/packages/npm-test-platform/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-platform/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-platform/package.json b/test/packages/npm-test-platform/package.json
deleted file mode 100644
index d6c3e09e1..000000000
--- a/test/packages/npm-test-platform/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{"name":"npm-test-platform"
-,"version":"9.9.9-9"
-,"homepage":"http://www.youtube.com/watch?v=dQw4w9WgXcQ"
-,"os":["!this_is_not_a_real_os", "!neither_is_this"]
-,"cpu":["!this_is_not_a_real_cpu","!this_isnt_either"]}
diff --git a/test/packages/npm-test-private/README b/test/packages/npm-test-private/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-private/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-private/package.json b/test/packages/npm-test-private/package.json
deleted file mode 100644
index 3d95a37af..000000000
--- a/test/packages/npm-test-private/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{"name":"npm-test-private"
-,"version":"9.9.9-9"
-,"homepage":"http://www.youtube.com/watch?v=1MLry6Cn_D4"
-,"private":"true"}
diff --git a/test/packages/npm-test-shrinkwrap/README b/test/packages/npm-test-shrinkwrap/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-shrinkwrap/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-shrinkwrap/npm-shrinkwrap.json b/test/packages/npm-test-shrinkwrap/npm-shrinkwrap.json
deleted file mode 100644
index 4f8b22d05..000000000
--- a/test/packages/npm-test-shrinkwrap/npm-shrinkwrap.json
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "name": "npm-test-shrinkwrap",
- "version": "0.0.0",
- "dependencies": {
- "glob": {
- "version": "3.1.5",
- "from": "git://github.com/isaacs/node-glob.git#npm-test",
- "resolved": "git://github.com/isaacs/node-glob.git#67bda227fd7a559cca5620307c7d30a6732a792f",
- "dependencies": {
- "graceful-fs": {
- "version": "1.1.5",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.1.5.tgz",
- "dependencies": {
- "fast-list": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/fast-list/-/fast-list-1.0.2.tgz"
- }
- }
- },
- "inherits": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz"
- },
- "minimatch": {
- "version": "0.2.1",
- "dependencies": {
- "lru-cache": {
- "version": "1.0.5"
- }
- }
- }
- }
- },
- "minimatch": {
- "version": "0.1.5",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.1.5.tgz",
- "dependencies": {
- "lru-cache": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-1.0.5.tgz"
- }
- }
- },
- "npm-test-single-file": {
- "version": "1.2.3",
- "resolved": "https://gist.github.com/isaacs/1837112/raw/9ef57a59fc22aeb1d1ca346b68826dcb638b8416/index.js"
- }
- }
-}
diff --git a/test/packages/npm-test-shrinkwrap/package.json b/test/packages/npm-test-shrinkwrap/package.json
deleted file mode 100644
index a5d446e2d..000000000
--- a/test/packages/npm-test-shrinkwrap/package.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
- "name": "npm-test-shrinkwrap",
- "version": "0.0.0",
- "dependencies": {
- "npm-test-single-file": "https://gist.github.com/isaacs/1837112/raw/9ef57a59fc22aeb1d1ca346b68826dcb638b8416/index.js",
- "glob": "git://github.com/isaacs/node-glob.git#npm-test",
- "minimatch": "~0.1.0"
- },
- "scripts": {
- "test": "node test.js"
- }
-}
diff --git a/test/packages/npm-test-shrinkwrap/test.js b/test/packages/npm-test-shrinkwrap/test.js
deleted file mode 100644
index e40ae9b65..000000000
--- a/test/packages/npm-test-shrinkwrap/test.js
+++ /dev/null
@@ -1,37 +0,0 @@
-var assert = require('assert')
-
-process.env.npm_config_prefix = process.cwd()
-delete process.env.npm_config_global
-delete process.env.npm_config_depth
-
-var npm = process.env.npm_execpath
-
-require('child_process').execFile(process.execPath, [npm, 'ls', '--json'],
- { stdio: 'pipe', env: process.env, cwd: process.cwd() },
- function (err, stdout, stderr) {
- if (err) throw err
-
- var actual = JSON.parse(stdout)
- var expected = require('./npm-shrinkwrap.json')
- rmFrom(actual)
- actual = actual.dependencies
- rmFrom(expected)
- expected = expected.dependencies
- console.error(JSON.stringify(actual, null, 2))
- console.error(JSON.stringify(expected, null, 2))
-
- assert.deepEqual(actual, expected)
- }
-)
-
-function rmFrom (obj) {
- for (var i in obj) {
- if (i === 'from') {
- delete obj[i]
- } else if (i === 'dependencies') {
- for (var j in obj[i]) {
- rmFrom(obj[i][j])
- }
- }
- }
-}
diff --git a/test/packages/npm-test-test-package/README b/test/packages/npm-test-test-package/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-test-package/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-test-package/package.json b/test/packages/npm-test-test-package/package.json
deleted file mode 100644
index c5c5aeabc..000000000
--- a/test/packages/npm-test-test-package/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{ "name":"npm-test-test-package"
-, "author" : "Testy McMock"
-, "version" : "1.2.3-99-b"
-, "description" : "This is a test package used for debugging. It has some random data and that's all."
-}
diff --git a/test/packages/npm-test-url-dep/README b/test/packages/npm-test-url-dep/README
deleted file mode 100644
index 8848f0786..000000000
--- a/test/packages/npm-test-url-dep/README
+++ /dev/null
@@ -1 +0,0 @@
-just an npm test
diff --git a/test/packages/npm-test-url-dep/package.json b/test/packages/npm-test-url-dep/package.json
deleted file mode 100644
index f1949d838..000000000
--- a/test/packages/npm-test-url-dep/package.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{ "name":"npm-test-url-dep"
-, "version" : "1.2.3"
-, "dependencies" :
- { "jsonify" : "https://github.com/substack/jsonify/tarball/master"
- , "sax": "isaacs/sax-js"
- , "canonical-host": "git://github.com/isaacs/canonical-host"
- } }
diff --git a/test/run.js b/test/run.js
deleted file mode 100644
index 24c7a31da..000000000
--- a/test/run.js
+++ /dev/null
@@ -1,194 +0,0 @@
-// Everything in this file uses child processes, because we're
-// testing a command line utility.
-
-var chain = require('slide').chain
-var child_process = require('child_process')
-var path = require('path')
-var testdir = __dirname
-var fs = require('graceful-fs')
-var npmpkg = path.dirname(testdir)
-var npmcli = path.resolve(npmpkg, 'bin', 'npm-cli.js')
-
-var temp = process.env.TMPDIR ||
- process.env.TMP ||
- process.env.TEMP ||
- (process.platform === 'win32'
- ? 'c:\\windows\\temp'
- : '/tmp')
-
-temp = path.resolve(temp, 'npm-test-' + process.pid)
-
-var root = path.resolve(temp, 'root')
-var cache = path.resolve(temp, 'npm_cache')
-
-var failures = 0
-var mkdir = require('mkdirp')
-var rimraf = require('rimraf')
-
-var pathEnvSplit = process.platform === 'win32' ? ';' : ':'
-var pathEnv = process.env.PATH.split(pathEnvSplit)
-var npmPath = process.platform === 'win32' ? root : path.join(root, 'bin')
-
-pathEnv.unshift(npmPath, path.join(root, 'node_modules', '.bin'))
-
-// lastly, make sure that we get the same node that is being used to do
-// run this script. That's very important, especially when running this
-// test file from in the node source folder.
-pathEnv.unshift(path.dirname(process.execPath))
-
-// the env for all the test installs etc.
-var env = {}
-Object.keys(process.env).forEach(function (i) {
- env[i] = process.env[i]
-})
-env.npm_config_prefix = root
-env.npm_config_color = 'always'
-env.npm_config_global = 'true'
-// have to set this to false, or it'll try to test itself forever
-env.npm_config_npat = 'false'
-env.PATH = pathEnv.join(pathEnvSplit)
-env.NODE_PATH = path.join(root, 'node_modules')
-env.npm_config_cache = cache
-env.npm_config_user_agent = ''
-
-function cleanup (cb) {
- if (failures !== 0) return
- rimraf(root, function (er) {
- if (er) cb(er)
- mkdir(root, parseInt('0755', 8), cb)
- })
-}
-
-function prefix (content, pref) {
- return pref + (content.trim().split(/\r?\n/).join('\n' + pref))
-}
-
-var execCount = 0
-function exec (cmd, cwd, shouldFail, cb) {
- if (typeof shouldFail === 'function') {
- cb = shouldFail
- shouldFail = false
- }
- console.error('\n+' + cmd + (shouldFail ? ' (expect failure)' : ''))
-
- // special: replace 'node' with the current execPath,
- // and 'npm' with the thing we installed.
- var cmdShow = cmd
- var npmReplace = path.resolve(npmPath, 'npm')
- var nodeReplace = process.execPath
- if (process.platform === 'win32') {
- npmReplace = '"' + npmReplace + '"'
- nodeReplace = '"' + nodeReplace + '"'
- }
- cmd = cmd.replace(/^npm /, npmReplace + ' ')
- cmd = cmd.replace(/^node /, nodeReplace + ' ')
-
- console.error('$$$$$$ cd %s; PATH=%s %s', cwd, env.PATH, cmd)
-
- child_process.exec(cmd, {cwd: cwd, env: env}, function (er, stdout, stderr) {
- console.error('$$$$$$ after command', cmd, cwd)
- if (stdout) {
- console.error(prefix(stdout, ' 1> '))
- }
- if (stderr) {
- console.error(prefix(stderr, ' 2> '))
- }
-
- execCount++
- if (!shouldFail && !er || shouldFail && er) {
- // stdout = (''+stdout).trim()
- console.log('ok ' + execCount + ' ' + cmdShow)
- return cb()
- } else {
- console.log('not ok ' + execCount + ' ' + cmdShow)
- cb(new Error('failed ' + cmdShow))
- }
- })
-}
-
-function execChain (cmds, cb) {
- chain(cmds.map(function (args) {
- return [exec].concat(args)
- }), cb)
-}
-
-function flatten (arr) {
- return arr.reduce(function (l, r) {
- return l.concat(r)
- }, [])
-}
-
-function setup (cb) {
- cleanup(function (er) {
- if (er) return cb(er)
- exec('node \'' + npmcli + '\' install \'' + npmpkg + '\'', root, false, cb)
- })
-}
-
-function main (cb) {
- console.log('# testing in %s', temp)
- console.log('# global prefix = %s', root)
-
- failures = 0
-
- process.chdir(testdir)
- var base = path.resolve(root, path.join('lib', 'node_modules'))
-
- // get the list of packages
- var packages = fs.readdirSync(path.resolve(testdir, 'packages'))
- packages = packages.filter(function (p) {
- return p && !p.match(/^\./)
- })
-
- installAllThenTestAll()
-
- function installAllThenTestAll () {
- var packagesToRm = packages.slice(0)
- if (process.platform !== 'win32') {
- // Windows can't handle npm rm npm due to file-in-use issues.
- packagesToRm.push('npm')
- }
-
- chain(
- [
- setup,
- [exec, 'npm install ' + npmpkg, testdir],
- [execChain, packages.map(function (p) {
- return [ 'npm install packages/' + p, testdir ]
- })],
- [execChain, packages.map(function (p) {
- return [ 'npm test -ddd', path.resolve(base, p) ]
- })],
- [execChain, packagesToRm.map(function (p) {
- return [ 'npm rm ' + p, root ]
- })],
- installAndTestEach
- ],
- cb
- )
- }
-
- function installAndTestEach (cb) {
- var thingsToChain = [
- setup,
- [execChain, flatten(packages.map(function (p) {
- return [
- ['npm install packages/' + p, testdir],
- ['npm test', path.resolve(base, p)],
- ['npm rm ' + p, root]
- ]
- }))]
- ]
- if (process.platform !== 'win32') {
- // Windows can't handle npm rm npm due to file-in-use issues.
- thingsToChain.push([exec, 'npm rm npm', testdir])
- }
-
- chain(thingsToChain, cb)
- }
-}
-
-main(function (er) {
- console.log('1..' + execCount)
- if (er) throw er
-})
diff --git a/test/tap/legacy-array-bin.js b/test/tap/legacy-array-bin.js
new file mode 100644
index 000000000..3e421ee23
--- /dev/null
+++ b/test/tap/legacy-array-bin.js
@@ -0,0 +1,80 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-array-bin')
+var modulepath = path.resolve(basepath, 'node_modules')
+var installedpath = path.resolve(modulepath, 'npm-test-array-bin')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+var fixture = new Tacks(
+ Dir({
+ bin: Dir({
+ 'array-bin': File(
+ '#!/usr/bin/env node\n' +
+ "console.log('test ran ok')\n"
+ )
+ }),
+ 'package.json': File({
+ name: 'npm-test-array-bin',
+ version: '1.2.5',
+ bin: [
+ 'bin/array-bin'
+ ],
+ scripts: {
+ test: 'node test.js'
+ }
+ }),
+ 'test.js': File(
+ "require('child_process').exec('array-bin', { env: process.env },\n" +
+ ' function (err, stdout, stderr) {\n' +
+ " if (err && err.code) throw new Error('exited badly with code = ' + err.code)\n" +
+ ' console.log(stdout)\n' +
+ ' console.error(stderr)\n' +
+ ' }\n' +
+ ')\n'
+ )
+ })
+)
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+test('array-bin', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ t.is(code, 0, 'install went ok')
+ t.equal(stderr, '', 'no error output')
+ common.npm(['test'], {cwd: installedpath}, testCheckAndRemove)
+ }
+ function testCheckAndRemove (err, code, stdout, stderr) {
+ t.ifError(err, 'npm test on array bin')
+ t.equal(code, 0, 'exited OK')
+ t.equal(stderr.trim(), '', 'no error output')
+ t.match(stdout, /test ran ok/, 'child script ran properly')
+ common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
+ }
+ function removeCheckAndDone (err, code, stdout, stderr) {
+ if (err) throw err
+ t.is(code, 0, 'remove went ok')
+ t.done()
+ }
+})
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-bundled-git.js b/test/tap/legacy-bundled-git.js
new file mode 100644
index 000000000..355f9467c
--- /dev/null
+++ b/test/tap/legacy-bundled-git.js
@@ -0,0 +1,103 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-bundled-git')
+var modulepath = path.resolve(basepath, 'node_modules')
+var installedpath = path.resolve(modulepath, 'npm-test-bundled-git')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+
+var minimatchExpected = {
+ name: 'minimatch',
+ description: 'a glob matcher in javascript',
+ version: '0.2.1',
+ repository: {
+ type: 'git',
+ url: 'git://github.com/isaacs/minimatch.git'
+ },
+ main: 'minimatch.js',
+ scripts: {
+ test: 'tap test'
+ },
+ engines: {
+ node: '*'
+ },
+ dependencies: {
+ 'lru-cache': '~1.0.5'
+ },
+ devDependencies: {
+ tap: '~0.1.3'
+ },
+ licenses: [
+ {
+ type: 'MIT',
+ url: 'http://github.com/isaacs/minimatch/raw/master/LICENSE'
+ }
+ ]
+}
+
+var fixture = new Tacks(
+ Dir({
+ README: File(
+ 'just an npm test\n'
+ ),
+ 'package.json': File({
+ name: 'npm-test-bundled-git',
+ scripts: {
+ test: 'node test.js'
+ },
+ version: '1.2.5',
+ dependencies: {
+ glob: 'git://github.com/isaacs/node-glob.git#npm-test'
+ },
+ bundledDependencies: [
+ 'glob'
+ ]
+ })
+ })
+)
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+test('bundled-git', function (t) {
+ common.npm(['install', '--global-style', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'install went ok')
+
+ var actual = require(path.resolve(installedpath, 'node_modules/glob/node_modules/minimatch/package.json'))
+ Object.keys(minimatchExpected).forEach(function (key) {
+ t.isDeeply(actual[key], minimatchExpected[key], key + ' set to the right value')
+ })
+
+ common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
+ }
+ function removeCheckAndDone (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'remove went ok')
+ t.done()
+ }
+})
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-dir-bin.js b/test/tap/legacy-dir-bin.js
new file mode 100644
index 000000000..e9e6bdfe1
--- /dev/null
+++ b/test/tap/legacy-dir-bin.js
@@ -0,0 +1,79 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-dir-bin')
+var modulepath = path.resolve(basepath, 'node_modules')
+var installedpath = path.resolve(modulepath, 'npm-test-dir-bin')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+var fixture = new Tacks(
+ Dir({
+ bin: Dir({
+ 'dir-bin': File(
+ '#!/usr/bin/env node\n' +
+ "console.log('test ran ok')\n"
+ )
+ }),
+ 'package.json': File({
+ name: 'npm-test-dir-bin',
+ version: '1.2.5',
+ directories: {
+ bin: './bin'
+ },
+ scripts: {
+ test: 'node test.js'
+ }
+ }),
+ 'test.js': File(
+ "require('child_process').exec('dir-bin', { env: process.env },\n" +
+ ' function (err, stdout, stderr) {\n' +
+ " if (err && err.code) throw new Error('exited badly with code = ' + err.code)\n" +
+ ' console.log(stdout)\n' +
+ ' console.error(stderr)\n' +
+ ' }\n' +
+ ')\n'
+ )
+ })
+)
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+test('dir-bin', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ t.is(code, 0, 'install went ok')
+ common.npm(['test'], {cwd: installedpath}, testCheckAndRemove)
+ }
+ function testCheckAndRemove (err, code, stdout, stderr) {
+ t.ifError(err, 'npm test on array bin')
+ t.equal(code, 0, 'exited OK')
+ t.equal(stderr.trim(), '', 'no error output')
+ t.match(stdout, /test ran ok/, 'child script ran properly')
+ common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
+ }
+ function removeCheckAndDone (err, code, stdout, stderr) {
+ if (err) throw err
+ t.is(code, 0, 'remove went ok')
+ t.done()
+ }
+})
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-env-reader.js b/test/tap/legacy-env-reader.js
new file mode 100644
index 000000000..8dc5efebf
--- /dev/null
+++ b/test/tap/legacy-env-reader.js
@@ -0,0 +1,87 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-env-reader')
+var modulepath = path.resolve(basepath, 'node_modules')
+var installedpath = path.resolve(modulepath, 'npm-test-env-reader')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+var fixture = new Tacks(
+ Dir({
+ README: File(
+ 'just an npm test\n'
+ ),
+ 'package.json': File({
+ name: 'npm-test-env-reader',
+ version: '1.2.3',
+ scripts: {
+ install: 'node test.js',
+ preinstall: 'node test.js',
+ preuninstall: 'node test.js',
+ postuninstall: 'node test.js',
+ test: 'node test.js',
+ stop: 'node test.js',
+ start: 'node test.js',
+ restart: 'node test.js',
+ foo: 'node test.js'
+ }
+ }),
+ 'test.js': File(
+ 'var envs = []\n' +
+ 'for (var e in process.env) {\n' +
+ " if (e.match(/npm|^path$/i)) envs.push(e + '=' + process.env[e])\n" +
+ '}\n' +
+ 'envs.sort(function (a, b) {\n' +
+ ' return a === b ? 0 : a > b ? -1 : 1\n' +
+ '}).forEach(function (e) {\n' +
+ ' console.log(e)\n' +
+ '})\n'
+ )
+ })
+)
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+test('env-reader', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'install went ok')
+ common.npm(['test'], {cwd: installedpath}, testCheckAndRemove)
+ }
+ function testCheckAndRemove (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'test went ok')
+ common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
+ }
+ function removeCheckAndDone (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'remove went ok')
+ t.done()
+ }
+})
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-files.js b/test/tap/legacy-files.js
new file mode 100644
index 000000000..e153b2533
--- /dev/null
+++ b/test/tap/legacy-files.js
@@ -0,0 +1,131 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-files')
+var modulepath = path.resolve(basepath, 'node_modules')
+var installedpath = path.resolve(modulepath, 'npm-test-files')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+var fixture = new Tacks(
+ Dir({
+ '.npmignore': File(
+ '/sub/ignore1\n' +
+ './sub/include2\n' +
+ 'ignore3\n' +
+ './include4\n' +
+ 'ignoredir1\n' +
+ 'ignoredir2/\n' +
+ '*.tgz\n'
+ ),
+ README: File(
+ 'just an npm test\n'
+ ),
+ ignore3: File(''),
+ ignoredir1: Dir({
+ 'a': File('')
+ }),
+ ignoredir2: Dir({
+ 'a': File('')
+ }),
+ include4: File(''),
+ 'package.json': File({
+ name: 'npm-test-files',
+ version: '1.2.5',
+ files: [
+ 'include4',
+ 'sub/include',
+ 'sub/include2',
+ 'sub/include4',
+ 'test.sh',
+ '.npmignore'
+ ],
+ scripts: {
+ test: 'bash test.sh'
+ }
+ }),
+ sub: Dir({
+ ignore1: File(''),
+ ignore3: File(''),
+ include: File(''),
+ include2: File(''),
+ include4: File(
+ 'This file should be in the package.\n'
+ )
+ }),
+ 'test.sh': File(
+ 'x=`find . | grep ignore | grep -v npmignore`\n' +
+ 'if [ "$x" != "" ]; then\n' +
+ ' echo "ignored files included: $x"\n' +
+ ' exit 1\n' +
+ 'fi\n' +
+ '\n' +
+ 'x=`find . | grep -v ignore | sort`\n' +
+ 'y=".\n' +
+ './include4\n' +
+ './package.json\n' +
+ './sub\n' +
+ './sub/include\n' +
+ './sub/include2\n' +
+ './sub/include4\n' +
+ './test.sh"\n' +
+ 'if [ "$x" != "$y" ]; then\n' +
+ ' echo "missing included files"\n' +
+ ' echo "got:"\n' +
+ ' echo "==="\n' +
+ ' echo "$x"\n' +
+ ' echo "==="\n' +
+ ' echo "wanted:"\n' +
+ ' echo "==="\n' +
+ ' echo "$y"\n' +
+ ' echo "==="\n' +
+ ' exit 1\n' +
+ 'fi\n'
+ )
+ })
+)
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+test('files', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'install went ok')
+ common.npm(['test'], {cwd: installedpath}, testCheckAndRemove)
+ }
+ function testCheckAndRemove (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'test went ok')
+ common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
+ }
+ function removeCheckAndDone (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'remove went ok')
+ t.done()
+ }
+})
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-ignore-nested-nm.js b/test/tap/legacy-ignore-nested-nm.js
new file mode 100644
index 000000000..095c41efa
--- /dev/null
+++ b/test/tap/legacy-ignore-nested-nm.js
@@ -0,0 +1,64 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-ignore-nested-nm')
+var modulepath = path.resolve(basepath, 'node_modules')
+var installedpath = path.resolve(modulepath, 'npm-test-ignore-nested-nm')
+var fs = require('graceful-fs')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+
+var fileData = 'I WILL NOT BE IGNORED!\n'
+var fixture = new Tacks(
+ Dir({
+ lib: Dir({
+ node_modules: Dir({
+ foo: File(fileData)
+ })
+ }),
+ 'package.json': File({
+ name: 'npm-test-ignore-nested-nm',
+ version: '1.2.5'
+ })
+ })
+)
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+test('ignore-nested-nm', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ t.is(code, 0, 'install went ok')
+ var foopath = path.resolve(installedpath, 'lib/node_modules/foo')
+ fs.readFile(foopath, function (err, data) {
+ t.ifError(err, 'file read successfully')
+ t.equal(data.toString(), fileData)
+ common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
+ })
+ }
+ function removeCheckAndDone (err, code, stdout, stderr) {
+ if (err) throw err
+ t.is(code, 0, 'remove went ok')
+ t.done()
+ }
+})
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-ignore.js b/test/tap/legacy-ignore.js
new file mode 100644
index 000000000..94f3bff08
--- /dev/null
+++ b/test/tap/legacy-ignore.js
@@ -0,0 +1,125 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-ignore')
+var modulepath = path.resolve(basepath, 'node_modules')
+var installedpath = path.resolve(modulepath, 'npm-test-ignore')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+var fixture = new Tacks(
+ Dir({
+ '.npmignore': File(
+ '/sub/ignore1\n' +
+ './sub/include2\n' +
+ 'ignore3\n' +
+ './include4\n' +
+ 'ignoredir1\n' +
+ 'ignoredir2/\n' +
+ '*.tgz\n'
+ ),
+ README: File(
+ 'just an npm test\n'
+ ),
+ ignore3: File(''),
+ ignoredir1: Dir({
+ 'a': File('')
+ }),
+ ignoredir2: Dir({
+ 'a': File('')
+ }),
+ include4: File(''),
+ 'package.json': File({
+ name: 'npm-test-ignore',
+ version: '1.2.5',
+ scripts: {
+ test: 'bash test.sh'
+ }
+ }),
+ sub: Dir({
+ ignore1: File(''),
+ ignore3: File(''),
+ include: File(''),
+ include2: File(''),
+ include4: File(
+ 'This file should be in the package.\n'
+ )
+ }),
+ 'test.sh': File(
+ 'x=`find . | grep ignore | grep -v npmignore`\n' +
+ 'if [ "$x" != "" ]; then\n' +
+ ' echo "ignored files included: $x"\n' +
+ ' exit 1\n' +
+ 'fi\n' +
+ '\n' +
+ 'x=`find . | grep -v ignore | sort`\n' +
+ 'y=".\n' +
+ './include4\n' +
+ './package.json\n' +
+ './README\n' +
+ './sub\n' +
+ './sub/include\n' +
+ './sub/include2\n' +
+ './sub/include4\n' +
+ './test.sh"\n' +
+ 'y="`echo "$y" | sort`"\n' +
+ 'if [ "$x" != "$y" ]; then\n' +
+ ' echo "missing included files"\n' +
+ ' echo "got:"\n' +
+ ' echo "==="\n' +
+ ' echo "$x"\n' +
+ ' echo "==="\n' +
+ ' echo "wanted:"\n' +
+ ' echo "==="\n' +
+ ' echo "$y"\n' +
+ ' echo "==="\n' +
+ ' exit 1\n' +
+ 'fi\n'
+ )
+ })
+)
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+test('ignore', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'install went ok')
+ common.npm(['test'], {cwd: installedpath}, testCheckAndRemove)
+ }
+ function testCheckAndRemove (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'test went ok')
+ common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
+ }
+ function removeCheckAndDone (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'remove went ok')
+ t.done()
+ }
+})
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-missing-bindir.js b/test/tap/legacy-missing-bindir.js
new file mode 100644
index 000000000..a55703beb
--- /dev/null
+++ b/test/tap/legacy-missing-bindir.js
@@ -0,0 +1,82 @@
+'use strict'
+var path = require('path')
+var fs = require('fs')
+var test = require('tap').test
+var common = require('../common-tap.js')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-missing-bindir')
+var modulepath = path.resolve(basepath, 'node_modules')
+var installedpath = path.resolve(modulepath, 'npm-test-missing-bindir')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+
+var fixture = new Tacks(
+ Dir({
+ README: File(
+ 'just an npm test\n'
+ ),
+ 'package.json': File({
+ name: 'npm-test-missing-bindir',
+ version: '0.0.0',
+ directories: {
+ bin: './not-found'
+ }
+ })
+ })
+)
+
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+
+function installedExists (filename) {
+ try {
+ fs.statSync(path.resolve(installedpath, filename))
+ return true
+ } catch (ex) {
+ console.log(ex)
+ return false
+ }
+}
+
+test('missing-bindir', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ if (stderr) console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'install went ok')
+ t.is(installedExists('README'), true, 'README')
+ t.is(installedExists('package.json'), true, 'package.json')
+ common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
+ }
+
+ function removeCheckAndDone (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'remove went ok')
+ t.done()
+ }
+})
+
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-optional-deps.js b/test/tap/legacy-optional-deps.js
new file mode 100644
index 000000000..80ad7cc47
--- /dev/null
+++ b/test/tap/legacy-optional-deps.js
@@ -0,0 +1,79 @@
+'use strict'
+var path = require('path')
+var fs = require('fs')
+var test = require('tap').test
+var common = require('../common-tap.js')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var mr = require('npm-registry-mock')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-optional-deps')
+var modulepath = path.resolve(basepath, 'node_modules')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+
+var fixture = new Tacks(
+ Dir({
+ README: File(
+ 'just an npm test\n'
+ ),
+ 'package.json': File({
+ name: 'npm-test-optional-deps',
+ version: '1.2.5',
+ optionalDependencies: {
+ 'npm-test-foobarzaaakakaka': 'http://example.com/',
+ async: '10.999.14234',
+ mkdirp: '0.3.5',
+ optimist: 'some invalid version 99 #! $$ x y z',
+ 'npm-test-failer': '*'
+ }
+ })
+ })
+)
+
+var server
+
+test('setup', function (t) {
+ setup()
+ mr({port: common.port}, function (err, s) {
+ if (err) throw err
+ server = s
+ t.done()
+ })
+})
+
+test('optional-deps', function (t) {
+ server.get('/npm-test-failer').reply(404, {error: 'nope'})
+
+ var opts = ['--registry=' + common.registry, '--timeout=100']
+ common.npm(opts.concat(['install', fixturepath]), {cwd: basepath}, installCheckAndTest)
+
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ if (stderr) console.error(stderr)
+ server.done()
+ t.is(code, 0, 'install went ok')
+ var dir = fs.readdirSync(modulepath).sort()
+ t.isDeeply(dir, ['mkdirp', 'npm-test-optional-deps'], 'only one optional dep should be there')
+ t.is(require(path.resolve(modulepath, 'mkdirp', 'package.json')).version, '0.3.5', 'mkdirp version right')
+ t.done()
+ }
+})
+
+test('cleanup', function (t) {
+ cleanup()
+ server.close()
+ t.done()
+})
+
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-platform-all.js b/test/tap/legacy-platform-all.js
new file mode 100644
index 000000000..2bfb19a45
--- /dev/null
+++ b/test/tap/legacy-platform-all.js
@@ -0,0 +1,73 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-platform-all')
+var modulepath = path.resolve(basepath, 'node_modules')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+
+var fixture = new Tacks(
+ Dir({
+ README: File(
+ 'just an npm test\n'
+ ),
+ 'package.json': File({
+ name: 'npm-test-platform-all',
+ version: '9.9.9-9',
+ homepage: 'http://www.zombo.com/',
+ os: [
+ 'darwin',
+ 'linux',
+ 'win32',
+ 'solaris',
+ 'haiku',
+ 'sunos',
+ 'freebsd',
+ 'openbsd',
+ 'netbsd'
+ ],
+ cpu: [
+ 'arm',
+ 'mips',
+ 'ia32',
+ 'x64',
+ 'sparc'
+ ]
+ })
+ })
+)
+
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+
+test('platform-all', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ t.is(stderr, '', 'no error messages')
+ t.is(code, 0, 'install went ok')
+ t.done()
+ }
+})
+
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-platform.js b/test/tap/legacy-platform.js
new file mode 100644
index 000000000..4e94148b2
--- /dev/null
+++ b/test/tap/legacy-platform.js
@@ -0,0 +1,64 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-platform')
+var modulepath = path.resolve(basepath, 'node_modules')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+
+var fixture = new Tacks(
+ Dir({
+ README: File(
+ 'just an npm test\n'
+ ),
+ 'package.json': File({
+ name: 'npm-test-platform',
+ version: '9.9.9-9',
+ homepage: 'http://www.youtube.com/watch?v=dQw4w9WgXcQ',
+ os: [
+ '!this_is_not_a_real_os',
+ '!neither_is_this'
+ ],
+ cpu: [
+ '!this_is_not_a_real_cpu',
+ '!this_isnt_either'
+ ]
+ })
+ })
+)
+
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+
+test('platform', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ t.is(code, 0, 'install went ok')
+ t.done()
+ }
+})
+
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-private.js b/test/tap/legacy-private.js
new file mode 100644
index 000000000..5e7817bf6
--- /dev/null
+++ b/test/tap/legacy-private.js
@@ -0,0 +1,58 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-private')
+var modulepath = path.resolve(basepath, 'node_modules')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+
+var fixture = new Tacks(
+ Dir({
+ README: File(
+ 'just an npm test\n'
+ ),
+ 'package.json': File({
+ name: 'npm-test-private',
+ version: '9.9.9-9',
+ homepage: 'http://www.youtube.com/watch?v=1MLry6Cn_D4',
+ private: 'true'
+ })
+ })
+)
+
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+
+test('private', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'install went ok')
+ t.done()
+ }
+})
+
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-shrinkwrap.js b/test/tap/legacy-shrinkwrap.js
new file mode 100644
index 000000000..6f5303037
--- /dev/null
+++ b/test/tap/legacy-shrinkwrap.js
@@ -0,0 +1,132 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+
+var fixture = new Tacks(
+ Dir({
+ README: File(
+ 'just an npm test\n'
+ ),
+ 'npm-shrinkwrap.json': File({
+ name: 'npm-test-shrinkwrap',
+ version: '0.0.0',
+ dependencies: {
+ glob: {
+ version: '3.1.5',
+ from: 'git://github.com/isaacs/node-glob.git#npm-test',
+ resolved: 'git://github.com/isaacs/node-glob.git#67bda227fd7a559cca5620307c7d30a6732a792f',
+ dependencies: {
+ 'graceful-fs': {
+ version: '1.1.5',
+ resolved: 'https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.1.5.tgz',
+ dependencies: {
+ 'fast-list': {
+ version: '1.0.2',
+ resolved: 'https://registry.npmjs.org/fast-list/-/fast-list-1.0.2.tgz'
+ }
+ }
+ },
+ inherits: {
+ version: '1.0.0',
+ resolved: 'https://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz'
+ },
+ minimatch: {
+ version: '0.2.1',
+ dependencies: {
+ 'lru-cache': {
+ version: '1.0.5'
+ }
+ }
+ }
+ }
+ },
+ minimatch: {
+ version: '0.1.5',
+ resolved: 'https://registry.npmjs.org/minimatch/-/minimatch-0.1.5.tgz',
+ dependencies: {
+ 'lru-cache': {
+ version: '1.0.5',
+ resolved: 'https://registry.npmjs.org/lru-cache/-/lru-cache-1.0.5.tgz'
+ }
+ }
+ },
+ 'npm-test-single-file': {
+ version: '1.2.3',
+ resolved: 'https://gist.github.com/isaacs/1837112/raw/9ef57a59fc22aeb1d1ca346b68826dcb638b8416/index.js'
+ }
+ }
+ }),
+ 'package.json': File({
+ author: 'Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)',
+ name: 'npm-test-shrinkwrap',
+ version: '0.0.0',
+ dependencies: {
+ 'npm-test-single-file': 'https://gist.github.com/isaacs/1837112/raw/9ef57a59fc22aeb1d1ca346b68826dcb638b8416/index.js',
+ glob: 'git://github.com/isaacs/node-glob.git#npm-test',
+ minimatch: '~0.1.0'
+ },
+ scripts: {
+ test: 'node test.js'
+ }
+ })
+ })
+)
+
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+
+test('shrinkwrap', function (t) {
+ common.npm(['install'], {cwd: basepath}, installCheckAndTest)
+
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ t.is(code, 0, 'install went ok')
+
+ common.npm(['ls', '--json'], {cwd: basepath}, verifyLsMatchesShrinkwrap)
+ }
+
+ function verifyLsMatchesShrinkwrap (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ t.is(code, 0, 'ls went ok')
+ var actual = JSON.parse(stdout)
+ var expected = require(path.resolve(basepath, 'npm-shrinkwrap.json'))
+ // from is expected to vary
+ t.isDeeply(rmFrom(actual), rmFrom(expected))
+ t.done()
+ }
+
+ function rmFrom (obj) {
+ for (var i in obj) {
+ if (i === 'from') {
+ delete obj[i]
+ } else if (i === 'dependencies') {
+ for (var j in obj[i]) {
+ rmFrom(obj[i][j])
+ }
+ }
+ }
+ }
+})
+
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+
+function setup () {
+ cleanup()
+ fixture.create(basepath)
+}
+
+function cleanup () {
+ fixture.remove(basepath)
+}
diff --git a/test/tap/legacy-test-package.js b/test/tap/legacy-test-package.js
new file mode 100644
index 000000000..b0cbaa01a
--- /dev/null
+++ b/test/tap/legacy-test-package.js
@@ -0,0 +1,76 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-test-package')
+var modulepath = path.resolve(basepath, 'node_modules')
+var installedpath = path.resolve(modulepath, 'npm-test-test-package')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+
+var fixture = new Tacks(
+ Dir({
+ README: File(
+ 'just an npm test\n'
+ ),
+ 'package.json': File({
+ name: 'npm-test-test-package',
+ author: 'Testy McMock',
+ version: '1.2.3-99-b',
+ description: "This is a test package used for debugging. It has some random data and that's all."
+ })
+ })
+)
+
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+
+test('test-package', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'install went ok')
+ common.npm(['test'], {cwd: installedpath}, testCheckAndRemove)
+ }
+
+ function testCheckAndRemove (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'npm test w/o test is ok')
+ common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
+ }
+
+ function removeCheckAndDone (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'remove went ok')
+ t.done()
+ }
+})
+
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}
diff --git a/test/tap/legacy-url-dep.js b/test/tap/legacy-url-dep.js
new file mode 100644
index 000000000..9807d6916
--- /dev/null
+++ b/test/tap/legacy-url-dep.js
@@ -0,0 +1,61 @@
+'use strict'
+var test = require('tap').test
+var common = require('../common-tap.js')
+var path = require('path')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var fixturepath = path.resolve(basepath, 'npm-test-url-dep')
+var modulepath = path.resolve(basepath, 'node_modules')
+var Tacks = require('tacks')
+var File = Tacks.File
+var Dir = Tacks.Dir
+
+var fixture = new Tacks(
+ Dir({
+ README: File(
+ 'just an npm test\n'
+ ),
+ 'package.json': File({
+ name: 'npm-test-url-dep',
+ version: '1.2.3',
+ dependencies: {
+ jsonify: 'https://github.com/substack/jsonify/tarball/master',
+ sax: 'isaacs/sax-js',
+ 'canonical-host': 'git://github.com/isaacs/canonical-host'
+ }
+ })
+ })
+)
+
+test('setup', function (t) {
+ setup()
+ t.done()
+})
+
+test('url-dep', function (t) {
+ common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
+ function installCheckAndTest (err, code, stdout, stderr) {
+ if (err) throw err
+ console.error(stderr)
+ console.log(stdout)
+ t.is(code, 0, 'install went ok')
+ t.done()
+ }
+})
+
+test('cleanup', function (t) {
+ cleanup()
+ t.done()
+})
+
+function setup () {
+ cleanup()
+ fixture.create(fixturepath)
+ mkdirp.sync(modulepath)
+}
+
+function cleanup () {
+ fixture.remove(fixturepath)
+ rimraf.sync(basepath)
+}