1var test = require('tap').test 2var common = require('../common-tap') 3var path = require('path') 4var rimraf = require('rimraf') 5var mkdirp = require('mkdirp') 6var pkg = path.resolve(__dirname, 'git-cache-locking') 7var tmp = path.join(pkg, 'tmp') 8var cache = path.join(pkg, 'cache') 9 10test('setup', function (t) { 11 rimraf.sync(pkg) 12 mkdirp.sync(path.resolve(pkg, 'node_modules')) 13 t.end() 14}) 15 16test('git-cache-locking: install a git dependency', function (t) { 17 // disable git integration tests on Travis. 18 if (process.env.TRAVIS) return t.end() 19 20 var gitEnv = Object.assign({}, process.env) 21 gitEnv.npm_config_cache = cache 22 gitEnv.npm_config_tmp = tmp 23 gitEnv.npm_config_prefix = pkg 24 gitEnv.npm_config_global = 'false' 25 26 // package c depends on a.git#master and b.git#master 27 // package b depends on a.git#master 28 common.npm([ 29 'install', 30 'git://github.com/nigelzor/npm-4503-c.git' 31 ], { 32 cwd: pkg, 33 env: gitEnv 34 }, function (err, code, stdout, stderr) { 35 if (err) throw err 36 t.equal(0, code, 'npm install should succeed') 37 t.end() 38 }) 39}) 40 41test('cleanup', function (t) { 42 rimraf.sync(pkg) 43 t.end() 44}) 45