1 var test = require("tap").test
3 , path = require("path")
4 , rimraf = require("rimraf")
5 , mkdirp = require("mkdirp")
6 , spawn = require("child_process").spawn
7 , npmCli = require.resolve("../../bin/npm-cli.js")
8 , node = process.execPath
9 , pkg = path.resolve(__dirname, "git-cache-no-hooks")
10 , tmp = path.join(pkg, "tmp")
11 , cache = path.join(pkg, "cache")
14 test("setup", function (t) {
19 mkdirp.sync(path.resolve(pkg, "node_modules"))
23 test("git-cache-no-hooks: install a git dependency", function (t) {
25 // disable git integration tests on Travis.
26 if (process.env.TRAVIS) return t.end()
28 var command = [ npmCli
30 , "git://github.com/nigelzor/npm-4503-a.git"
32 var child = spawn(node, command, {
35 "npm_config_cache" : cache,
36 "npm_config_tmp" : tmp,
37 "npm_config_prefix" : pkg,
38 "npm_config_global" : "false",
39 "npm_config_umask" : "00",
40 HOME : process.env.HOME,
41 Path : process.env.PATH,
42 PATH : process.env.PATH
47 child.on("close", function (code) {
48 t.equal(code, 0, "npm install should succeed")
50 // verify permissions on git hooks
51 var repoDir = "git-github-com-nigelzor-npm-4503-a-git-40c5cb24"
52 var hooksPath = path.join(cache, "_git-remotes", repoDir, "hooks")
53 fs.readdir(hooksPath, function (err) {
54 t.equal(err && err.code, "ENOENT", "hooks are not brought along with repo")
60 test("cleanup", function (t) {