Files
pnpm/pnpm11/lockfile/utils/test/refIsLocalTarball.test.ts
Zoltan Kochan b63db7ff88 fix: update injected workspace dependencies when lockfile is not shared (#15356)
When `shared-workspace-lockfile` is set to false and a workspace project depends on an injected workspace package, re-resolve and update the lockfile when the injected package's own dependencies change.

In v11, ensure `linkedPackagesAreUpToDate` inspects directory dependencies recorded in lockfile importer snapshots even when the declared specifier is a workspace protocol, and strip peer parameter suffixes before checking tarball extensions.

In v12, bypass the optimistic repeat install fast-path when an importer declares injected dependencies, and verify directory dependency freshness during lockfile validation.

Closes pnpm/pnpm#7209
2026-09-24 12:30:34 +02:00

21 lines
944 B
TypeScript

import { expect, test } from '@jest/globals'
import { refIsLocalDirectory, refIsLocalTarball } from '@pnpm/lockfile.utils'
test('refIsLocalTarball recognizes tarball extensions including bzip2', () => {
for (const ext of ['.tgz', '.tar.gz', '.tar', '.tar.bz2', '.tbz2', '.tbz', '.TGZ', '.TAR.BZ2']) {
expect(refIsLocalTarball(`file:../pkg${ext}`)).toBe(true)
expect(refIsLocalDirectory(`file:../pkg${ext}`)).toBe(false)
}
expect(refIsLocalTarball('file:../pkg')).toBe(false)
expect(refIsLocalDirectory('file:../pkg')).toBe(true)
expect(refIsLocalTarball('file:../pkg.tgz(react@18.0.0)')).toBe(true)
expect(refIsLocalDirectory('file:../pkg(react@18.0.0)')).toBe(true)
expect(refIsLocalTarball('file:../pkg(test).tgz')).toBe(true)
expect(refIsLocalTarball('file:../pkg(test).tgz(react@18.0.0)')).toBe(true)
expect(refIsLocalTarball('pkg@1.0.0')).toBe(false)
expect(refIsLocalDirectory('pkg@1.0.0')).toBe(false)
})