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:
authorForrest L Norvell <forrest@npmjs.com>2014-07-23 05:34:29 +0400
committerForrest L Norvell <forrest@npmjs.com>2014-07-23 05:34:29 +0400
commitcd422c9de510766797c65720d70f085000f50543 (patch)
tree9cb27e6df1852cb59eaaee3acfc23d6c38b47a23 /test
parentdf4b0e7fc1abd9a54f98db75ec9e4d03d37d125b (diff)
link binaries for scoped packages (fixes #5748)
Diffstat (limited to 'test')
-rw-r--r--test/tap/install-scoped-link.js53
-rw-r--r--test/tap/install-scoped/package.json7
-rw-r--r--test/tap/install-scoped/world.js1
3 files changed, 61 insertions, 0 deletions
diff --git a/test/tap/install-scoped-link.js b/test/tap/install-scoped-link.js
new file mode 100644
index 000000000..83a6d88cc
--- /dev/null
+++ b/test/tap/install-scoped-link.js
@@ -0,0 +1,53 @@
+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(modules)
+
+ t.end()
+})
diff --git a/test/tap/install-scoped/package.json b/test/tap/install-scoped/package.json
new file mode 100644
index 000000000..32700cf6a
--- /dev/null
+++ b/test/tap/install-scoped/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "@scoped/package",
+ "version": "0.0.0",
+ "bin": {
+ "hello": "./world.js"
+ }
+}
diff --git a/test/tap/install-scoped/world.js b/test/tap/install-scoped/world.js
new file mode 100644
index 000000000..f6333ba5b
--- /dev/null
+++ b/test/tap/install-scoped/world.js
@@ -0,0 +1 @@
+console.log("hello blrbld")