2 var test = require('tap').test
3 var common = require('../common-tap.js')
4 var path = require('path')
5 var rimraf = require('rimraf')
6 var mkdirp = require('mkdirp')
7 var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
8 var fixturepath = path.resolve(basepath, 'npm-test-ignore-nested-nm')
9 var modulepath = path.resolve(basepath, 'node_modules')
10 var installedpath = path.resolve(modulepath, 'npm-test-ignore-nested-nm')
11 var fs = require('graceful-fs')
12 var Tacks = require('tacks')
16 var fileData = 'I WILL NOT BE IGNORED!\n'
17 var fixture = new Tacks(
24 'package.json': File({
25 name: 'npm-test-ignore-nested-nm',
30 test('setup', function (t) {
34 test('ignore-nested-nm', function (t) {
35 common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest)
36 function installCheckAndTest (err, code, stdout, stderr) {
38 t.is(code, 0, 'install went ok')
39 var foopath = path.resolve(installedpath, 'lib/node_modules/foo')
40 fs.readFile(foopath, function (err, data) {
41 t.ifError(err, 'file read successfully')
42 t.equal(data.toString(), fileData)
43 common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
46 function removeCheckAndDone (err, code, stdout, stderr) {
48 t.is(code, 0, 'remove went ok')
52 test('cleanup', function (t) {
58 fixture.create(fixturepath)
59 mkdirp.sync(modulepath)
62 fixture.remove(fixturepath)