diff options
author | Neil Gentleman <ngentleman@gmail.com> | 2014-01-16 16:08:15 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2014-02-17 06:15:27 +0400 |
commit | 164b97e6089f64e686db7a9a24016f245effc37f (patch) | |
tree | 8f9290650b99b8234368329876b8e9699ebca4fe /test | |
parent | 9dfcc314b2651ce609ffbcafbb710014f125a6f3 (diff) |
clean git url before locking
modifying the url inside the locked section was causing unlock() to be
called with a different value than was used in lock()
Diffstat (limited to 'test')
-rw-r--r-- | test/tap/git-cache-locking.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/tap/git-cache-locking.js b/test/tap/git-cache-locking.js new file mode 100644 index 000000000..cfea78da4 --- /dev/null +++ b/test/tap/git-cache-locking.js @@ -0,0 +1,43 @@ +var test = require("tap").test + , path = require("path") + , rimraf = require("rimraf") + , mkdirp = require("mkdirp") + , spawn = require("child_process").spawn + , npm = require.resolve("../../bin/npm-cli.js") + , node = process.execPath + , pkg = path.resolve(__dirname, "git-cache-locking") + , tmp = path.join(pkg, "tmp") + , cache = path.join(pkg, "cache") + +test("git-cache-locking: install a git dependency", function (t) { + t.plan(1) + + cleanup() + mkdirp.sync(cache) + mkdirp.sync(tmp) + + // package c depends on a.git#master and b.git#master + // package b depends on a.git#master + var child = spawn(node, [npm, "install", "git://github.com/nigelzor/npm-4503-c.git"], { + cwd: pkg, + env: { + npm_config_cache: cache, + npm_config_tmp: tmp, + npm_config_prefix: pkg, + npm_config_global: "false", + HOME: process.env.HOME, + Path: process.env.PATH, + PATH: process.env.PATH + }, + stdio: "inherit" + }) + + child.on("close", function (code) { + t.equal(0, code, "npm install should succeed") + cleanup() + }) +}) + +function cleanup() { + rimraf.sync(pkg) +} |