X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Ftest%2Ftap%2Finstall-scoped-with-peer-dependency.js;fp=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Ftest%2Ftap%2Finstall-scoped-with-peer-dependency.js;h=3a54b9a11f2dafe63312282457a753f35bc02ebc;hb=2529be6d456deeb07c128603ce4971f1dc29b695;hp=0000000000000000000000000000000000000000;hpb=2636fc31c16c23711cf2b06a4ae8537bba9c1d35;p=simantics%2Fdistrict.git diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/install-scoped-with-peer-dependency.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/install-scoped-with-peer-dependency.js new file mode 100644 index 00000000..3a54b9a1 --- /dev/null +++ b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/install-scoped-with-peer-dependency.js @@ -0,0 +1,60 @@ +var fs = require('fs') +var path = require('path') + +var mkdirp = require('mkdirp') +var osenv = require('osenv') +var rimraf = require('rimraf') +var test = require('tap').test + +var common = require('../common-tap.js') +var pkg = path.join(__dirname, 'install-scoped-with-peer-dependency') +var local = path.join(pkg, 'package') + +var EXEC_OPTS = { } + +var json = { + name: '@scope/package', + version: '0.0.0', + peerDependencies: { + underscore: '*' + } +} + +test('setup', function (t) { + setup() + + t.end() +}) + +test('it should install peerDependencies in same tree level as the parent package', function (t) { + common.npm(['install', './package'], EXEC_OPTS, function (err, code, stdout, stderr) { + t.ifError(err, 'install local package successful') + t.equal(code, 0, 'npm install exited with code') + t.notOk(stderr, 'npm install exited without any error output') + + var p = path.resolve(pkg, 'node_modules/underscore/package.json') + t.ok(JSON.parse(fs.readFileSync(p, 'utf8'))) + t.end() + }) +}) + +test('cleanup', function (t) { + cleanup() + t.end() +}) + +function setup () { + cleanup() + mkdirp.sync(local) + mkdirp.sync(path.resolve(pkg, 'node_modules')) + fs.writeFileSync( + path.join(local, 'package.json'), + JSON.stringify(json, null, 2) + ) + process.chdir(pkg) +} + +function cleanup () { + process.chdir(osenv.tmpdir()) + rimraf.sync(pkg) +}