mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-11 01:15:11 -04:00
27 lines
704 B
TypeScript
27 lines
704 B
TypeScript
import path from 'path'
|
|
import { add, install } from '@pnpm/plugin-commands-installation'
|
|
import { prepareEmpty } from '@pnpm/prepare'
|
|
import { DEFAULT_OPTS } from './utils'
|
|
|
|
test('install fails if no package.json is found', async () => {
|
|
prepareEmpty()
|
|
|
|
await expect(install.handler({
|
|
...DEFAULT_OPTS,
|
|
dir: process.cwd(),
|
|
})).rejects.toThrow(/No package\.json found/)
|
|
})
|
|
|
|
test('install does not fail when a new package is added', async () => {
|
|
prepareEmpty()
|
|
|
|
await add.handler({
|
|
...DEFAULT_OPTS,
|
|
dir: process.cwd(),
|
|
}, ['is-positive@1.0.0'])
|
|
|
|
const pkg = await import(path.resolve('package.json'))
|
|
|
|
expect(pkg?.dependencies).toStrictEqual({ 'is-positive': '1.0.0' })
|
|
})
|