Skip to content

Commit

Permalink
Add test case for reify removing indirect dep
Browse files Browse the repository at this point in the history
This test case demonstrates npm#7746.
Currently, it fails. Note that it passes if reify is called twice.
  • Loading branch information
Trevor Burnham committed Aug 23, 2024
1 parent e674987 commit 3d79338
Show file tree
Hide file tree
Showing 42 changed files with 46,382 additions and 14,973 deletions.
9 changes: 9 additions & 0 deletions workspaces/arborist/test/arborist/reify.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,15 @@ t.test('update a node without updating a child that has bundle deps', t => {
}))
})

t.only('restore missing parent while preserving child node', async t => {
const path = fixture(t, 'lockfile-with-missing-parent')
await reify(path)
const parentPath = `${path}/node_modules/globby`
t.equal(fs.statSync(`${parentPath}/package.json`).isFile(), true, 'parent has package.json')
const childPath = `${path}/node_modules/globby/node_modules/minimatch`
t.equal(fs.statSync(`${childPath}/package.json`).isFile(), true, 'child has package.json')
})

t.test('optional dependency failures', t => {
const cases = [
'optional-dep-tgz-missing',
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "lockfile-with-missing-parent",
"version": "1.0.0",
"dependencies": {
"glob": "7.1.6",
"globby": "1.2.0",
"minimatch": "3.0.3"
}
}
Loading

0 comments on commit 3d79338

Please sign in to comment.