summaryrefslogtreecommitdiff
path: root/deps/npm/test/tap/git-cache-locking.js
blob: 39f8b279c3b258e2763d58ed229694b5cfc46559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var test = require("tap").test
  , common = require("../common-tap")
  , path = require("path")
  , rimraf = require("rimraf")
  , mkdirp = require("mkdirp")
  , pkg = path.resolve(__dirname, "git-cache-locking")
  , tmp = path.join(pkg, "tmp")
  , cache = path.join(pkg, "cache")


test("setup", function (t) {
  rimraf.sync(pkg)
  mkdirp.sync(path.resolve(pkg, "node_modules"))
  t.end()
})

test("git-cache-locking: install a git dependency", function (t) {

  // disable git integration tests on Travis.
  if (process.env.TRAVIS) return t.end()

  // package c depends on a.git#master and b.git#master
  // package b depends on a.git#master
  common.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
    }
  }, function (err, code) {
    t.ifErr(err, "npm install finished without error")
    t.equal(0, code, "npm install should succeed")
    t.end()
  })
})

test("cleanup", function(t) {
  rimraf.sync(pkg)
  t.end()
})