Files
pnpm/pkg-manager/core/test/packageImportMethods.ts

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' })
})