1'use strict' 2var test = require('tap').test 3var common = require('../common-tap.js') 4var path = require('path') 5var rimraf = require('rimraf') 6var mkdirp = require('mkdirp') 7var basepath = common.pkg 8var fixturepath = path.resolve(basepath, 'npm-test-private') 9var modulepath = path.resolve(basepath, 'node_modules') 10var Tacks = require('tacks') 11var File = Tacks.File 12var Dir = Tacks.Dir 13 14var fixture = new Tacks( 15 Dir({ 16 README: File( 17 'just an npm test\n' 18 ), 19 'package.json': File({ 20 name: 'npm-test-private', 21 version: '9.9.9-9', 22 homepage: 'http://www.youtube.com/watch?v=1MLry6Cn_D4', 23 private: 'true' 24 }) 25 }) 26) 27 28test('setup', function (t) { 29 setup() 30 t.done() 31}) 32 33test('private', function (t) { 34 common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest) 35 function installCheckAndTest (err, code, stdout, stderr) { 36 if (err) throw err 37 console.error(stderr) 38 console.log(stdout) 39 t.is(code, 0, 'install went ok') 40 t.done() 41 } 42}) 43 44test('cleanup', function (t) { 45 cleanup() 46 t.done() 47}) 48 49function setup () { 50 cleanup() 51 fixture.create(fixturepath) 52 mkdirp.sync(modulepath) 53} 54 55function cleanup () { 56 fixture.remove(fixturepath) 57 rimraf.sync(basepath) 58} 59