Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed May 18, 2024
1 parent ad7466a commit 33cc0e2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
7 changes: 4 additions & 3 deletions lockfile/lockfile-file/test/read.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
writeCurrentLockfile,
writeWantedLockfile,
} from '@pnpm/lockfile-file'
import { type DepPath } from '@pnpm/types'
import tempy from 'tempy'

jest.mock('@pnpm/git-utils', () => ({ getCurrentBranch: jest.fn() }))
Expand Down Expand Up @@ -177,20 +178,20 @@ test('existsNonEmptyWantedLockfile()', async () => {
},
lockfileVersion: '3',
packages: {
'is-negative/1.0.0': {
['is-negative/1.0.0' as DepPath]: {
dependencies: {
'is-positive': '2.0.0',
},
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-positive/1.0.0': {
['is-positive/1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-positive/2.0.0': {
['is-positive/2.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
Expand Down
47 changes: 24 additions & 23 deletions lockfile/prune-lockfile/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
pruneLockfile,
pruneSharedLockfile,
} from '@pnpm/prune-lockfile'
import { type DepPath } from '@pnpm/types'
import yaml from 'yaml-tag'

const DEFAULT_OPTS = {
Expand All @@ -26,12 +27,12 @@ test('remove one redundant package', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'is-positive@1.0.0': {
['is-positive@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-positive@2.0.0': {
['is-positive@2.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
Expand Down Expand Up @@ -111,20 +112,20 @@ test('keep all', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'is-negative@1.0.0': {
['is-negative@1.0.0' as DepPath]: {
dependencies: {
'is-positive': '2.0.0',
},
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-positive@1.0.0': {
['is-positive@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-positive@2.0.0': {
['is-positive@2.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
Expand Down Expand Up @@ -195,13 +196,13 @@ test('optional dependency should have optional = true', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'foo-child@1.0.0': {
['foo-child@1.0.0' as DepPath]: {
optional: true,
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'foo@1.0.0': {
['foo@1.0.0' as DepPath]: {
dependencies: {
'foo-child': '1.0.0',
},
Expand All @@ -210,20 +211,20 @@ test('optional dependency should have optional = true', () => {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-positive@1.0.0': {
['is-positive@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'parent-of-foo@1.0.0': {
['parent-of-foo@1.0.0' as DepPath]: {
dependencies: {
foo: '1.0.0',
},
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'pkg-with-good-optional@1.0.0': {
['pkg-with-good-optional@1.0.0' as DepPath]: {
optionalDependencies: {
foo: '1.0.0',
'is-positive': '1.0.0',
Expand Down Expand Up @@ -319,12 +320,12 @@ test('optional dependency should not have optional = true if used not only as op
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'is-positive@1.0.0': {
['is-positive@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'pkg-with-good-optional@1.0.0': {
['pkg-with-good-optional@1.0.0' as DepPath]: {
optionalDependencies: {
'is-positive': '1.0.0',
},
Expand Down Expand Up @@ -537,17 +538,17 @@ test('remove dependencies that are not in the package', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'fsevents@1.0.0': {
['fsevents@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-negative@1.0.0': {
['is-negative@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-positive@1.0.0': {
['is-positive@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
Expand Down Expand Up @@ -580,7 +581,7 @@ test(`ignore dependencies that are in package.json but are not in ${WANTED_LOCKF
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'is-positive@1.0.0': {
['is-positive@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
Expand Down Expand Up @@ -631,7 +632,7 @@ test('keep lockfileMinorVersion, if present', () => {
},
lockfileVersion: '5.2',
packages: {
'is-positive@1.0.0': {
['is-positive@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
Expand Down Expand Up @@ -681,7 +682,7 @@ test('keep linked package even if it is not in package.json', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'is-negative@1.0.0': {
['is-negative@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
Expand Down Expand Up @@ -739,17 +740,17 @@ test("prune: don't remove package used by another importer", () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'is-negative@1.0.0': {
['is-negative@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-positive@1.0.0': {
['is-positive@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-positive@2.0.0': {
['is-positive@2.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
Expand Down Expand Up @@ -809,12 +810,12 @@ test('pruneSharedLockfile: remove one redundant package', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'is-positive@1.0.0': {
['is-positive@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
},
'is-positive@2.0.0': {
['is-positive@2.0.0' as DepPath]: {
resolution: {
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=',
},
Expand Down

0 comments on commit 33cc0e2

Please sign in to comment.