diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2016-04-11 21:32:13 +0300 |
---|---|---|
committer | Jeremiah Senkpiel <fishrock123@rocketmail.com> | 2016-04-14 19:22:16 +0300 |
commit | 40e79b1305fb7b0f27278475c8d9ca60d1d5e9b4 (patch) | |
tree | ab47dc63a075962f1a9763bb94a485f9cb3563e7 /deps/npm/test/tap/link.js | |
parent | a432935211210bf1c92d057c455a5dd6aa5517ab (diff) |
deps: upgrade npm to 3.8.6
PR-URL: https://github.com/nodejs/node/pull/6153
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/test/tap/link.js')
-rw-r--r-- | deps/npm/test/tap/link.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/deps/npm/test/tap/link.js b/deps/npm/test/tap/link.js index 869364c29b5..e2f54552002 100644 --- a/deps/npm/test/tap/link.js +++ b/deps/npm/test/tap/link.js @@ -3,6 +3,7 @@ var osenv = require('osenv') var path = require('path') var rimraf = require('rimraf') var test = require('tap').test +var lstatSync = require('fs').lstatSync var writeFileSync = require('fs').writeFileSync var common = require('../common-tap.js') @@ -10,6 +11,7 @@ var common = require('../common-tap.js') var link = path.join(__dirname, 'link') var linkScoped = path.join(__dirname, 'link-scoped') var linkInstall = path.join(__dirname, 'link-install') +var linkInside = path.join(linkInstall, 'node_modules', 'inside') var linkRoot = path.join(__dirname, 'link-root') var config = 'prefix = ' + linkRoot @@ -57,6 +59,18 @@ var installJSON = { license: 'ISC' } +var insideInstallJSON = { + name: 'inside', + version: '1.0.0', + description: '', + main: 'index.js', + scripts: { + test: 'echo \"Error: no test specified\" && exit 1' + }, + author: '', + license: 'ISC' +} + test('setup', function (t) { setup() common.npm(['ls', '-g', '--depth=0'], OPTS, function (err, c, out) { @@ -81,6 +95,20 @@ test('create global link', function (t) { }) }) +test('create global inside link', function (t) { + process.chdir(linkInside) + common.npm(['link'], OPTS, function (err, c, out) { + t.ifError(err, 'link has no error') + common.npm(['ls', '-g'], OPTS, function (err, c, out, stderr) { + t.ifError(err) + t.equal(c, 0) + t.equal(stderr, '', 'got expected stderr') + t.has(out, /inside@1.0.0/, 'creates global inside link ok') + t.end() + }) + }) +}) + test('create scoped global link', function (t) { process.chdir(linkScoped) common.npm(['link'], OPTS, function (err, c, out) { @@ -108,6 +136,17 @@ test('link-install the package', function (t) { }) }) +test('link-inside-install fails', function (t) { + process.chdir(linkInstall) + t.notOk(lstatSync(linkInside).isSymbolicLink(), 'directory for linked package is not a symlink to begin with') + common.npm(['link', 'inside'], OPTS, function (err, code) { + t.ifError(err, 'npm removed the linked package without error') + t.notEqual(code, 0, 'link operation failed') + t.notOk(lstatSync(linkInside).isSymbolicLink(), 'directory for linked package has not turned into a symlink') + t.end() + }) +}) + test('link-install the scoped package', function (t) { process.chdir(linkInstall) common.npm(['link', linkScoped], OPTS, function (err) { @@ -141,6 +180,7 @@ function cleanup () { rimraf.sync(link) rimraf.sync(linkScoped) rimraf.sync(linkInstall) + rimraf.sync(linkInside) } function setup () { @@ -161,5 +201,10 @@ function setup () { path.join(linkInstall, 'package.json'), JSON.stringify(installJSON, null, 2) ) + mkdirp.sync(linkInside) + writeFileSync( + path.join(linkInside, 'package.json'), + JSON.stringify(insideInstallJSON, null, 2) + ) writeFileSync(configPath, config) } |