2 var path = require('path')
4 var mkdirp = require('mkdirp')
5 var osenv = require('osenv')
6 var rimraf = require('rimraf')
7 var test = require('tap').test
9 var common = require('../common-tap.js')
10 var pkg = path.join(__dirname, 'install-scoped-with-peer-dependency')
11 var local = path.join(pkg, 'package')
16 name: '@scope/package',
23 test('setup', function (t) {
29 test('it should install peerDependencies in same tree level as the parent package', function (t) {
30 common.npm(['install', './package'], EXEC_OPTS, function (err, code, stdout, stderr) {
31 t.ifError(err, 'install local package successful')
32 t.equal(code, 0, 'npm install exited with code')
33 t.notOk(stderr, 'npm install exited without any error output')
35 var p = path.resolve(pkg, 'node_modules/underscore/package.json')
36 t.ok(JSON.parse(fs.readFileSync(p, 'utf8')))
41 test('cleanup', function (t) {
49 mkdirp.sync(path.resolve(pkg, 'node_modules'))
51 path.join(local, 'package.json'),
52 JSON.stringify(json, null, 2)
58 process.chdir(osenv.tmpdir())