Files
pnpm/packages/calc-dep-state/test/lockfileToDepGraph.test.ts
Zoltan Kochan b3898dbb1e fix: take into account the integrities of packages in when calculating the dependency graph hash (#9605)
* fix: take into account the integrities of packages in when calculating the dependency graph hash

* test: fix

* test: fix

* test: fix

* test: fix

* fix: include the package's integirty in the hash as well

* docs: add comment

* perf: hashing deps graph

* fix: deps graph hash

* refactor: calc graph hash

* test: fix

* refactor: calc graph hash

* refactor: rename uniquePkgId to fullPkgId

* docs: add changeset
2025-06-08 01:05:10 +02:00

54 lines
1.1 KiB
TypeScript

import { lockfileToDepGraph } from '@pnpm/calc-dep-state'
import { type DepPath } from '@pnpm/types'
test('lockfileToDepGraph', () => {
expect(lockfileToDepGraph({
lockfileVersion: '9.0',
importers: {},
packages: {
['foo@1.0.0' as DepPath]: {
dependencies: {
bar: '1.0.0',
},
optionalDependencies: {
qar: '1.0.0',
},
resolution: {
integrity: '0',
},
},
['bar@1.0.0' as DepPath]: {
dependencies: {
qar: '1.0.0',
},
resolution: {
integrity: '1',
},
},
['qar@1.0.0' as DepPath]: {
resolution: {
integrity: '2',
},
},
},
})).toStrictEqual({
'bar@1.0.0': {
children: {
qar: 'qar@1.0.0',
},
fullPkgId: 'bar@1.0.0:1',
},
'foo@1.0.0': {
children: {
bar: 'bar@1.0.0',
qar: 'qar@1.0.0',
},
fullPkgId: 'foo@1.0.0:0',
},
'qar@1.0.0': {
children: {},
fullPkgId: 'qar@1.0.0:2',
},
})
})