1var common = require('../common-tap.js') 2var test = require('tap').test 3var mkdirp = require('mkdirp') 4var fs = require('fs') 5var rimraf = require('rimraf') 6var path = require('path') 7 8var pkg = common.pkg 9var pj = { 10 name: 'nested-extraneous', 11 version: '1.2.3' 12} 13 14var dep = path.resolve(pkg, 'node_modules', 'dep') 15var deppj = { 16 name: 'nested-extraneous-dep', 17 version: '1.2.3', 18 dependencies: { 19 'nested-extra-depdep': '*' 20 } 21} 22 23var depdep = path.resolve(dep, 'node_modules', 'depdep') 24var depdeppj = { 25 name: 'nested-extra-depdep', 26 version: '1.2.3' 27} 28 29test('setup', function (t) { 30 rimraf.sync(pkg) 31 mkdirp.sync(depdep) 32 fs.writeFileSync(path.resolve(pkg, 'package.json'), JSON.stringify(pj)) 33 fs.writeFileSync(path.resolve(dep, 'package.json'), JSON.stringify(deppj)) 34 fs.writeFileSync(path.resolve(depdep, 'package.json'), JSON.stringify(depdeppj)) 35 t.end() 36}) 37 38test('test', function (t) { 39 common.npm(['ls'], { 40 cwd: pkg 41 }, function (er, code, sto, ste) { 42 if (er) throw er 43 t.notEqual(code, 0) 44 t.notSimilar(ste, /depdep/) 45 t.notSimilar(sto, /depdep/) 46 t.end() 47 }) 48}) 49 50test('clean', function (t) { 51 rimraf.sync(pkg) 52 t.end() 53}) 54