Files
pnpm/packages/supi/test/packageImportMethods.ts
Zoltan Kochan 28d4812453 test(supi): speed up tests execution
Don't unpack all files when installing deps in tests

PR #2092
2019-10-18 22:18:00 +03:00

29 lines
1.1 KiB
TypeScript

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