Skip to content

Commit 3d79338

Browse files
author
Trevor Burnham
committed
Add test case for reify removing indirect dep
This test case demonstrates npm#7746. Currently, it fails. Note that it passes if reify is called twice.
1 parent e674987 commit 3d79338

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+46382
-14973
lines changed

Diff for: workspaces/arborist/test/arborist/reify.js

+9
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,15 @@ t.test('update a node without updating a child that has bundle deps', t => {
539539
}))
540540
})
541541

542+
t.only('restore missing parent while preserving child node', async t => {
543+
const path = fixture(t, 'lockfile-with-missing-parent')
544+
await reify(path)
545+
const parentPath = `${path}/node_modules/globby`
546+
t.equal(fs.statSync(`${parentPath}/package.json`).isFile(), true, 'parent has package.json')
547+
const childPath = `${path}/node_modules/globby/node_modules/minimatch`
548+
t.equal(fs.statSync(`${childPath}/package.json`).isFile(), true, 'child has package.json')
549+
})
550+
542551
t.test('optional dependency failures', t => {
543552
const cases = [
544553
'optional-dep-tgz-missing',

Diff for: workspaces/arborist/test/fixtures/lockfile-with-missing-parent/package-lock.json

+187
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "lockfile-with-missing-parent",
3+
"version": "1.0.0",
4+
"dependencies": {
5+
"glob": "7.1.6",
6+
"globby": "1.2.0",
7+
"minimatch": "3.0.3"
8+
}
9+
}

0 commit comments

Comments
 (0)