This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: npm/cli#2320 PR-URL: #192 Credit: @isaacs Close: #192 Reviewed-by: @ruyadorno
- Loading branch information
Showing
3 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27202,6 +27202,9 @@ Object { | |
"resolved": "https://registry.npmjs.org/c/-/c-1.2.3.tgz", | ||
"version": "npm:[email protected]", | ||
}, | ||
"e": Object { | ||
"version": "file:e", | ||
}, | ||
}, | ||
"lockfileVersion": 2, | ||
"name": "reify-saving-the-ideal-tree-save-some-stuff", | ||
|
@@ -27216,10 +27219,17 @@ Object { | |
"a": "github:foo/bar#baz", | ||
"b": "^1.2.3", | ||
"d": "npm:[email protected] <1.9.9", | ||
"e": "*", | ||
}, | ||
"devDependencies": Object { | ||
"c": "git+ssh://[email protected]:a/b/c.git#master", | ||
}, | ||
"workspaces": Array [ | ||
"e", | ||
], | ||
}, | ||
"e": Object { | ||
"extraneous": true, | ||
}, | ||
"node_modules/a": Object { | ||
"extraneous": true, | ||
|
@@ -27243,6 +27253,10 @@ Object { | |
"resolved": "https://registry.npmjs.org/c/-/c-1.2.3.tgz", | ||
"version": "1.2.3", | ||
}, | ||
"node_modules/e": Object { | ||
"link": true, | ||
"resolved": "e", | ||
}, | ||
}, | ||
"requires": true, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,14 +55,20 @@ const warningTracker = () => { | |
} | ||
|
||
const Node = requireInject('../../lib/node.js', { fs: fsMock }) | ||
const Link = requireInject('../../lib/link.js', { | ||
fs: fsMock, | ||
'../../lib/node.js': Node, | ||
}) | ||
const Shrinkwrap = requireInject('../../lib/shrinkwrap.js', { | ||
fs: fsMock, | ||
'../../lib/node.js': Node, | ||
'../../lib/link.js': Link, | ||
}) | ||
const Arborist = requireInject('../../lib/arborist', { | ||
rimraf: rimrafMock, | ||
fs: fsMock, | ||
'../../lib/node.js': Node, | ||
'../../lib/link.js': Link, | ||
}) | ||
|
||
const registryServer = require('../fixtures/registry-mocks/server.js') | ||
|
@@ -837,16 +843,26 @@ t.test('saving the ideal tree', t => { | |
a: 'git+ssh://[email protected]:foo/bar#baz', | ||
b: '', | ||
d: 'd@npm:[email protected] <1.9.9', | ||
e: 'file:e', | ||
}, | ||
devDependencies: { | ||
c: `git+ssh://[email protected]:a/b/c.git#master`, | ||
}, | ||
workspaces: [ | ||
'e', | ||
], | ||
} | ||
|
||
const npa = require('npm-package-arg') | ||
const kResolvedAdd = Symbol.for('resolvedAdd') | ||
const path = t.testdir({ | ||
'package.json': JSON.stringify(pkg) | ||
'package.json': JSON.stringify(pkg), | ||
e: { | ||
'package.json': JSON.stringify({name: 'e'}), | ||
}, | ||
node_modules: { | ||
e: t.fixture('symlink', '../e'), | ||
}, | ||
}) | ||
const a = newArb({ path }) | ||
const hash = '71f3ccfefba85d2048484569dba8c1829f6f41d7' | ||
|
@@ -886,12 +902,30 @@ t.test('saving the ideal tree', t => { | |
}, | ||
parent: tree, | ||
}) | ||
const target = new Node({ | ||
name: 'e', | ||
pkg: { | ||
name: 'e', | ||
}, | ||
path: resolve(tree.path, 'e'), | ||
fsParent: tree, | ||
}) | ||
new Link({ | ||
name: 'e', | ||
realpath: target.path, | ||
path: resolve(tree.path, 'node_modules/e'), | ||
resolved: 'file:../e', | ||
pkg: { | ||
name: 'e', | ||
}, | ||
}) | ||
|
||
a[kResolvedAdd] = [ | ||
npa('a@git+ssh://[email protected]:foo/bar#baz'), | ||
npa('b'), | ||
npa('d@npm:[email protected] <1.9.9'), | ||
npa(`c@git+ssh://[email protected]:a/b/c.git#master`), | ||
npa('c@git+ssh://[email protected]:a/b/c.git#master'), | ||
npa('e'), | ||
] | ||
return a[kSaveIdealTree]({ | ||
savePrefix: '~', | ||
|
@@ -904,7 +938,11 @@ t.test('saving the ideal tree', t => { | |
a: 'github:foo/bar#baz', | ||
b: '^1.2.3', | ||
d: 'npm:[email protected] <1.9.9', | ||
e: '*', | ||
}, | ||
workspaces: [ | ||
'e', | ||
], | ||
devDependencies: { | ||
c: 'git+ssh://[email protected]:a/b/c.git#master', | ||
}, | ||
|