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 33cc0e2 commit 2262d62
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 42 deletions.
33 changes: 17 additions & 16 deletions lockfile/filter-lockfile/test/filterByImporters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants'
import { filterLockfileByImporters } from '@pnpm/filter-lockfile'
import { type DepPath } from '@pnpm/types'

test('filterByImporters(): only prod dependencies of one importer', () => {
const filteredLockfile = filterLockfileByImporters(
Expand Down Expand Up @@ -32,17 +33,17 @@ test('filterByImporters(): only prod dependencies of one importer', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'dev-dep@1.0.0': {
['dev-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'optional-dep@1.0.0': {
['optional-dep@1.0.0' as DepPath]: {
optional: true,
resolution: { integrity: '' },
},
'prod-dep-dep@1.0.0': {
['prod-dep-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'prod-dep@1.0.0': {
['prod-dep@1.0.0' as DepPath]: {
dependencies: {
'prod-dep-dep': '1.0.0',
},
Expand All @@ -51,7 +52,7 @@ test('filterByImporters(): only prod dependencies of one importer', () => {
},
resolution: { integrity: '' },
},
'project-2-prod-dep@1.0.0': {
['project-2-prod-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
},
Expand Down Expand Up @@ -130,7 +131,7 @@ test('filterByImporters(): fail on missing packages when failOnMissingDependenci
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'prod-dep@1.0.0': {
['prod-dep@1.0.0' as DepPath]: {
dependencies: {
'prod-dep-dep': '1.0.0',
},
Expand Down Expand Up @@ -176,7 +177,7 @@ test('filterByImporters(): do not fail on missing packages when failOnMissingDep
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'prod-dep@1.0.0': {
['prod-dep@1.0.0' as DepPath]: {
dependencies: {
'prod-dep-dep': '1.0.0',
},
Expand Down Expand Up @@ -257,17 +258,17 @@ test('filterByImporters(): do not include skipped packages', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'dev-dep@1.0.0': {
['dev-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'optional-dep@1.0.0': {
['optional-dep@1.0.0' as DepPath]: {
optional: true,
resolution: { integrity: '' },
},
'prod-dep-dep@1.0.0': {
['prod-dep-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'prod-dep@1.0.0': {
['prod-dep@1.0.0' as DepPath]: {
dependencies: {
'prod-dep-dep': '1.0.0',
},
Expand All @@ -276,7 +277,7 @@ test('filterByImporters(): do not include skipped packages', () => {
},
resolution: { integrity: '' },
},
'project-2-prod-dep@1.0.0': {
['project-2-prod-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
},
Expand Down Expand Up @@ -364,19 +365,19 @@ test('filterByImporters(): exclude orphan packages', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'orphan@1.0.0': {
['orphan@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'prod-dep-dep@1.0.0': {
['prod-dep-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'prod-dep@1.0.0': {
['prod-dep@1.0.0' as DepPath]: {
dependencies: {
'prod-dep-dep': '1.0.0',
},
resolution: { integrity: '' },
},
'project-2-prod-dep@1.0.0': {
['project-2-prod-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
},
Expand Down
53 changes: 27 additions & 26 deletions lockfile/filter-lockfile/test/filterByImportersAndEngine.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LOCKFILE_VERSION } from '@pnpm/constants'
import { filterLockfileByImportersAndEngine } from '@pnpm/filter-lockfile'
import { type DepPath } from '@pnpm/types'

const REGIONAL_ARCH = Object.assign({}, process.arch)
const REGIONAL_CPU = Object.assign({}, process.platform)
Expand Down Expand Up @@ -57,21 +58,21 @@ test('filterByImportersAndEngine(): skip packages that are not installable', ()
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'bar@1.0.0': {
['bar@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'dev-dep@1.0.0': {
['dev-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'foo@1.0.0': {
['foo@1.0.0' as DepPath]: {
optional: true,
resolution: { integrity: '' },
},
'not-skipped-optional@1.0.0': {
['not-skipped-optional@1.0.0' as DepPath]: {
optional: true,
resolution: { integrity: '' },
},
'optional-dep@1.0.0': {
['optional-dep@1.0.0' as DepPath]: {
dependencies: {
bar: '1.0.0',
foo: '1.0.0',
Expand All @@ -82,10 +83,10 @@ test('filterByImportersAndEngine(): skip packages that are not installable', ()
optional: true,
resolution: { integrity: '' },
},
'prod-dep-dep@1.0.0': {
['prod-dep-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'prod-dep@1.0.0': {
['prod-dep@1.0.0' as DepPath]: {
dependencies: {
bar: '1.0.0',
'prod-dep-dep': '1.0.0',
Expand All @@ -95,7 +96,7 @@ test('filterByImportersAndEngine(): skip packages that are not installable', ()
},
resolution: { integrity: '' },
},
'project-2-prod-dep@1.0.0': {
['project-2-prod-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
},
Expand Down Expand Up @@ -242,21 +243,21 @@ test('filterByImportersAndEngine(): filter the packages that set os and cpu', ()
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'bar@1.0.0': {
['bar@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'dev-dep@1.0.0': {
['dev-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'foo@1.0.0': {
['foo@1.0.0' as DepPath]: {
optional: true,
resolution: { integrity: '' },
},
'not-skipped-optional@1.0.0': {
['not-skipped-optional@1.0.0' as DepPath]: {
optional: true,
resolution: { integrity: '' },
},
'optional-dep@1.0.0': {
['optional-dep@1.0.0' as DepPath]: {
dependencies: {
bar: '1.0.0',
foo: '1.0.0',
Expand All @@ -266,10 +267,10 @@ test('filterByImportersAndEngine(): filter the packages that set os and cpu', ()
optional: true,
resolution: { integrity: '' },
},
'prod-dep-dep@1.0.0': {
['prod-dep-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'prod-dep@1.0.0': {
['prod-dep@1.0.0' as DepPath]: {
dependencies: {
bar: '1.0.0',
'prod-dep-dep': '1.0.0',
Expand All @@ -279,7 +280,7 @@ test('filterByImportersAndEngine(): filter the packages that set os and cpu', ()
},
resolution: { integrity: '' },
},
'project-2-prod-dep@1.0.0': {
['project-2-prod-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
},
Expand Down Expand Up @@ -416,21 +417,21 @@ test('filterByImportersAndEngine(): filter the packages that set libc', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'bar@1.0.0': {
['bar@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'dev-dep@1.0.0': {
['dev-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'foo@1.0.0': {
['foo@1.0.0' as DepPath]: {
optional: true,
resolution: { integrity: '' },
},
'not-skipped-optional@1.0.0': {
['not-skipped-optional@1.0.0' as DepPath]: {
optional: true,
resolution: { integrity: '' },
},
'optional-dep@1.0.0': {
['optional-dep@1.0.0' as DepPath]: {
dependencies: {
bar: '1.0.0',
foo: '1.0.0',
Expand All @@ -439,10 +440,10 @@ test('filterByImportersAndEngine(): filter the packages that set libc', () => {
optional: true,
resolution: { integrity: '' },
},
'prod-dep-dep@1.0.0': {
['prod-dep-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'prod-dep@1.0.0': {
['prod-dep@1.0.0' as DepPath]: {
dependencies: {
bar: '1.0.0',
'prod-dep-dep': '1.0.0',
Expand All @@ -452,7 +453,7 @@ test('filterByImportersAndEngine(): filter the packages that set libc', () => {
},
resolution: { integrity: '' },
},
'project-2-prod-dep@1.0.0': {
['project-2-prod-dep@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
},
Expand Down Expand Up @@ -588,10 +589,10 @@ test('filterByImportersAndEngine(): includes linked packages', () => {
},
lockfileVersion: LOCKFILE_VERSION,
packages: {
'bar@1.0.0': {
['bar@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
'foo@1.0.0': {
['foo@1.0.0' as DepPath]: {
resolution: { integrity: '' },
},
},
Expand Down

0 comments on commit 2262d62

Please sign in to comment.