diff options
author | Rebecca Turner <me@re-becca.org> | 2015-08-21 14:36:13 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-08-27 02:51:12 +0300 |
commit | 4468c92eccd0814b567606897e0792e49640e056 (patch) | |
tree | 6a765a1fcc0d0fa8abe0d682a0db5fe49ece300d /test | |
parent | d088b7df7a6d620d0adac53a339c0108fe5f9685 (diff) |
deps: Use package relative paths for specifier realization
PR-URL: https://github.com/npm/npm/pull/9367
Fixes: #9205
Diffstat (limited to 'test')
-rw-r--r-- | test/tap/install-local-dep-cycle.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/test/tap/install-local-dep-cycle.js b/test/tap/install-local-dep-cycle.js new file mode 100644 index 000000000..1f76ad959 --- /dev/null +++ b/test/tap/install-local-dep-cycle.js @@ -0,0 +1,79 @@ +'use strict' +var path = require('path') +var fs = require('graceful-fs') +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') +var test = require('tap').test +var common = require('../common-tap.js') + +var base = path.join(__dirname, path.basename(__filename, '.js')) + +var baseJSON = { + name: 'base', + version: '1.0.0', + dependencies: { + a: 'file:a/', + b: 'file:b/' + } +} + +var aPath = path.join(base, 'a') +var aJSON = { + name: 'a', + version: '1.0.0', + dependencies: { + b: 'file:../b', + c: 'file:../c' + } +} + +var bPath = path.join(base, 'b') +var bJSON = { + name: 'b', + version: '1.0.0' +} + +var cPath = path.join(base, 'c') +var cJSON = { + name: 'c', + version: '1.0.0', + dependencies: { + b: 'file:../b' + } +} + +test('setup', function (t) { + cleanup() + setup() + t.end() +}) + +test('install', function (t) { + common.npm(['install'], {cwd: base}, function (er, code, stdout, stderr) { + t.ifError(er, 'npm config ran without issue') + t.is(code, 0, 'exited with a non-error code') + t.is(stderr, '', 'Ran without errors') + t.end() + }) +}) + +test('cleanup', function (t) { + cleanup() + t.end() +}) + +function saveJson (pkgPath, json) { + mkdirp.sync(pkgPath) + fs.writeFileSync(path.join(pkgPath, 'package.json'), JSON.stringify(json, null, 2)) +} + +function setup () { + saveJson(base, baseJSON) + saveJson(aPath, aJSON) + saveJson(bPath, bJSON) + saveJson(cPath, cJSON) +} + +function cleanup () { + rimraf.sync(base) +} |