mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-26 23:47:20 -04:00
* 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
54 lines
1.1 KiB
TypeScript
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',
|
|
},
|
|
})
|
|
})
|