Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: file dependency is locked without name #7228

Draft
wants to merge 1 commit into
base: latest
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33172,6 +33172,29 @@ exports[`test/arborist/reify.js TAP scoped registries > should preserve original
@ruyadorno/theoretically-private-pkg@https://npm.pkg.github.com/@ruyadorno/theoretically-private-pkg/-/theoretically-private-pkg-1.2.3.tgz
`

exports[`test/arborist/reify.js TAP second reify with file dependency should not change package-lock.json > must match snapshot 1`] = `
{
"name": "tap-testdir-reify-second-reify-with-file-dependency-should-not-change-package-lock.json",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"@test/a": "file:a"
}
},
"a": {
"name": "@test/a"
},
"node_modules/@test/a": {
"resolved": "a",
"link": true
}
}
}

`

exports[`test/arborist/reify.js TAP still do not install optional deps with mismatched platform specifications even when forced > expect resolving Promise 1`] = `
ArboristNode {
"edgesOut": Map {
Expand Down
23 changes: 23 additions & 0 deletions workspaces/arborist/test/arborist/reify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3281,3 +3281,26 @@ t.test('install stategy linked', async (t) => {
t.ok(abbrev.isSymbolicLink(), 'abbrev got installed')
})
})

t.test('second reify with file dependency should not change package-lock.json', async t => {
const path = t.testdir({
'package.json': JSON.stringify({
dependencies: {
'@test/a': 'file:a',
},
}),
a: {
'package.json': JSON.stringify({
name: '@test/a',
}),
},
})

const arb = newArb({ path })
await arb.reify()
const packageLockContent1 = fs.readFileSync(path + '/package-lock.json', 'utf8')
t.matchSnapshot(packageLockContent1)
await arb.reify()
const packageLockContent2 = fs.readFileSync(path + '/package-lock.json', 'utf8')
t.equal(packageLockContent2, packageLockContent1)
})