mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-24 01:51:41 -04:00
commit acba24cdeb2c2500b940c3c5cf94013ccde6e436 Author: Zoltan Kochan <z@kochan.io> Date: Sun Dec 29 19:39:17 2019 +0200 style: remove consecutive blank lines commit c8584b484662489bde7c5095df72c8e01ac828df Merge:56c54e8d9c9a3849Author: Zoltan Kochan <z@kochan.io> Date: Sun Dec 29 19:37:07 2019 +0200 Merge branch 'master' into refactor/typings/use-dt/tape-promise commit56c54e8d4eAuthor: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Sat Dec 28 13:15:00 2019 +0100 refactor(typings): Use `@types/tape‑promise` close #2241
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import * as pnpm from 'supi'
|
|
import test = require('tape')
|
|
import { testDefaults } from './utils'
|
|
|
|
test('API', (t) => {
|
|
t.equal(typeof pnpm.install, 'function', 'exports install()')
|
|
t.equal(typeof pnpm.linkFromGlobal, 'function', 'exports linkFromGlobal()')
|
|
t.equal(typeof pnpm.link, 'function', 'exports link()')
|
|
t.equal(typeof pnpm.linkToGlobal, 'function', 'exports linkToGlobal()')
|
|
t.end()
|
|
})
|
|
|
|
// TODO: some sort of this validation might need to exist
|
|
// maybe a new property should be introduced
|
|
// this seems illogical as even though all save types are false,
|
|
// the dependency will be saved
|
|
// tslint:disable-next-line:no-string-literal
|
|
test.skip('install fails when all saving types are false', async (t: test.Test) => {
|
|
try {
|
|
await pnpm.install({}, await testDefaults({ save: false, saveDev: false, saveOptional: false }))
|
|
t.fail('installation should have failed')
|
|
} catch (err) {
|
|
t.equal(err.message, 'Cannot install with save/saveDev/saveOptional all being equal false')
|
|
t.end()
|
|
}
|
|
})
|
|
|
|
test('install fails on optional = true but production = false', async (t: test.Test) => {
|
|
try {
|
|
const opts = await testDefaults({
|
|
include: {
|
|
dependencies: false,
|
|
devDependencies: false,
|
|
optionalDependencies: true,
|
|
},
|
|
})
|
|
await pnpm.install({}, opts)
|
|
t.fail('installation should have failed')
|
|
} catch (err) {
|
|
t.equal(err.message, 'Optional dependencies cannot be installed without production dependencies')
|
|
t.end()
|
|
}
|
|
})
|