Files
pnpm/pkg-manager/core/test/packageImportMethods.ts
Zoltan Kochan 47e45d717d feat!: breaking config changes in v8 (#6035)
* auto-install-peers=true
* save-workspace-protocol=rolling
* publishConfig.linkDirectory true by default
* resolve-peers-from-workspace-root is true by default
* set dedupeDirectDeps to true by default in @pnpm/core.
2023-02-05 11:43:22 +02:00

25 lines
1.1 KiB
TypeScript

import { prepareEmpty } from '@pnpm/prepare'
import { addDependenciesToPackage } from '@pnpm/core'
import { testDefaults } from './utils'
test('packageImportMethod can be set to copy', async () => {
const project = prepareEmpty()
await addDependenciesToPackage({}, ['is-negative'], await testDefaults({ fastUnpack: false }, {}, {}, { packageImportMethod: 'copy' }))
const m = project.requireModule('is-negative')
expect(m).toBeTruthy() // is-negative is available with packageImportMethod = copy
})
test('copy does not fail on package that self-requires itself', async () => {
const project = prepareEmpty()
await addDependenciesToPackage({}, ['@pnpm.e2e/requires-itself'], await testDefaults({}, {}, {}, { packageImportMethod: 'copy' }))
const m = project.requireModule('@pnpm.e2e/requires-itself/package.json')
expect(m).toBeTruthy() // requires-itself is available with packageImportMethod = copy
const lockfile = await project.readLockfile()
expect(lockfile.packages['/@pnpm.e2e/requires-itself@1.0.0'].dependencies).toStrictEqual({ 'is-positive': '1.0.0' })
})