-
-
Notifications
You must be signed in to change notification settings - Fork 940
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: rm should fail when called without params
- Loading branch information
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/plugin-commands-installation/test/remove/remove.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import PnpmError from '@pnpm/error' | ||
import { remove } from '@pnpm/plugin-commands-installation' | ||
import prepare, { preparePackages } from '@pnpm/prepare' | ||
import test = require('tape') | ||
import { DEFAULT_OPTS } from '../utils' | ||
|
||
test('remove should fail if no dependency is specified for removal', async (t) => { | ||
prepare(t) | ||
|
||
let err!: PnpmError | ||
try { | ||
await remove.handler({ | ||
...DEFAULT_OPTS, | ||
dir: process.cwd(), | ||
}, []) | ||
} catch (_err) { | ||
err = _err | ||
} | ||
t.equal(err.code, 'ERR_PNPM_MUST_REMOVE_SOMETHING') | ||
t.equal(err.message, 'At least one dependency name should be specified for removal') | ||
t.end() | ||
}) |