Skip to content

Commit

Permalink
chore: add reproduction test case for npm#6430
Browse files Browse the repository at this point in the history
  • Loading branch information
sonallux committed May 15, 2024
1 parent d5c3289 commit a537ea2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
23 changes: 23 additions & 0 deletions workspaces/arborist/tap-snapshots/test/arborist/reify.js.test.cjs
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)
})

0 comments on commit a537ea2

Please sign in to comment.