diff options
author | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-09-24 14:41:07 -0700 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-09-24 17:15:10 -0700 |
commit | 9fad8958df671c0e894506ef59b4c781c3dfb349 (patch) | |
tree | 4db7643b40c4ffd726fb27fb4aa276d420b3bfd8 /deps/npm/test/tap/install-scoped-link.js | |
parent | b26dd4e5ab9192bad72b9dc61fa4ad2d8f215da2 (diff) | |
download | android-node-v8-9fad8958df671c0e894506ef59b4c781c3dfb349.tar.gz android-node-v8-9fad8958df671c0e894506ef59b4c781c3dfb349.tar.bz2 android-node-v8-9fad8958df671c0e894506ef59b4c781c3dfb349.zip |
deps: upgrade npm to 2.0.0
Diffstat (limited to 'deps/npm/test/tap/install-scoped-link.js')
-rw-r--r-- | deps/npm/test/tap/install-scoped-link.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/deps/npm/test/tap/install-scoped-link.js b/deps/npm/test/tap/install-scoped-link.js new file mode 100644 index 0000000000..c411b664d7 --- /dev/null +++ b/deps/npm/test/tap/install-scoped-link.js @@ -0,0 +1,52 @@ +var exec = require("child_process").exec +var existsSync = require("fs").existsSync +var join = require("path").join +// var resolve = require("path").resolve + +var test = require("tap").test +var rimraf = require("rimraf") +var mkdirp = require("mkdirp") + +var npm = require("../../") + +var pkg = join(__dirname, "install-scoped") +var work = join(__dirname, "install-scoped-TEST") +var modules = join(work, "node_modules") + +test("setup", function (t) { + mkdirp.sync(modules) + process.chdir(work) + + t.end() +}) + +test("installing package with links", function (t) { + npm.load(function() { + npm.commands.install([pkg], function (err) { + t.ifError(err, "install ran to completion without error") + + t.ok( + existsSync(join(modules, "@scoped", "package", "package.json")), + "package installed" + ) + t.ok(existsSync(join(modules, ".bin")), "binary link directory exists") + + var hello = join(modules, ".bin", "hello") + t.ok(existsSync(hello), "binary link exists") + + exec("node " + hello, function (err, stdout, stderr) { + t.ifError(err, "command ran fine") + t.notOk(stderr, "got no error output back") + t.equal(stdout, "hello blrbld\n", "output was as expected") + + t.end() + }) + }) + }) +}) + +test("cleanup", function(t) { + process.chdir(__dirname) + rimraf.sync(work) + t.end() +}) |