]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/git-cache-no-hooks.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / test / tap / git-cache-no-hooks.js
1 var test = require("tap").test
2   , fs = require("fs")
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")
12
13
14 test("setup", function (t) {
15   rimraf.sync(pkg)
16   mkdirp.sync(pkg)
17   mkdirp.sync(cache)
18   mkdirp.sync(tmp)
19   mkdirp.sync(path.resolve(pkg, "node_modules"))
20   t.end()
21 })
22
23 test("git-cache-no-hooks: install a git dependency", function (t) {
24
25   // disable git integration tests on Travis.
26   if (process.env.TRAVIS) return t.end()
27
28   var command = [ npmCli
29                 , "install"
30                 , "git://github.com/nigelzor/npm-4503-a.git"
31                 ]
32   var child = spawn(node, command, {
33     cwd: pkg,
34     env: {
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
43     },
44     stdio: "inherit"
45   })
46
47   child.on("close", function (code) {
48     t.equal(code, 0, "npm install should succeed")
49
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")
55       t.end()
56     })
57   })
58 })
59
60 test("cleanup", function (t) {
61   rimraf.sync(pkg)
62   t.end()
63 })