1'use strict' 2var path = require('path') 3var test = require('tap').test 4var Tacks = require('tacks') 5var File = Tacks.File 6var Dir = Tacks.Dir 7var common = require('../common-tap.js') 8 9var basedir = common.pkg 10var testdir = path.join(basedir, 'testdir') 11var cachedir = common.cache 12var globaldir = path.join(basedir, 'global') 13var tmpdir = path.join(basedir, 'tmp') 14 15var conf = { 16 cwd: testdir, 17 env: Object.assign({ 18 npm_config_cache: cachedir, 19 npm_config_tmp: tmpdir, 20 npm_config_prefix: globaldir, 21 npm_config_registry: common.registry, 22 npm_config_loglevel: 'warn' 23 }, process.env) 24} 25 26var fixture = new Tacks(Dir({ 27 cache: Dir(), 28 global: Dir(), 29 tmp: Dir(), 30 testdir: Dir({ 31 node_modules: Dir({ 32 }), 33 package: Dir({ 34 node_modules: Dir({ 35 'bundled-dep': Dir({ 36 'package.json': File({ 37 name: 'bundled-dep', 38 version: '0.0.0' 39 }) 40 }) 41 }), 42 'package.json': File({ 43 name: '@scope/package', 44 version: '0.0.0', 45 dependencies: { 46 'bundled-dep': '*' 47 }, 48 bundledDependencies: [ 49 'bundled-dep' 50 ] 51 }) 52 }) 53 }) 54})) 55 56function setup () { 57 cleanup() 58 fixture.create(basedir) 59} 60 61function cleanup () { 62 fixture.remove(basedir) 63} 64 65test('setup', function (t) { 66 setup() 67 t.done() 68}) 69 70test('install dependencies of bundled dependencies', function (t) { 71 common.npm(['install', './package'], conf, function (err, code, stdout, stderr) { 72 if (err) throw err 73 t.is(code, 0, 'command ran ok') 74 t.comment(stdout.trim()) 75 t.comment(stderr.trim()) 76 t.done() 77 }) 78}) 79 80test('cleanup', function (t) { 81 cleanup() 82 t.done() 83}) 84