mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-31 19:18:19 -05:00
6
.changeset/lemon-meals-lick.md
Normal file
6
.changeset/lemon-meals-lick.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/parse-cli-args": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Don't ignore empty strings in params [#6594](https://github.com/pnpm/pnpm/issues/6594).
|
||||
@@ -139,8 +139,7 @@ export async function parseCliArgs (
|
||||
}
|
||||
}
|
||||
|
||||
// `pnpm install ""` is going to be just `pnpm install`
|
||||
const params = argv.remain.slice(1).filter(Boolean)
|
||||
const params = argv.remain.slice(1)
|
||||
|
||||
if (options['recursive'] !== true && (options['filter'] || options['filter-prod'] || recursiveCommandUsed)) {
|
||||
options['recursive'] = true
|
||||
|
||||
@@ -319,3 +319,20 @@ test('everything after an escape arg is a parameter, even if it has a help optio
|
||||
expect(cmd).toBe('exec')
|
||||
expect(params).toStrictEqual(['rm', '--help'])
|
||||
})
|
||||
|
||||
test('`pnpm install ""` is going to be just `pnpm install`', async () => {
|
||||
const { params, cmd } = await parseCliArgs({
|
||||
...DEFAULT_OPTS,
|
||||
}, ['install', ''])
|
||||
expect(cmd).toBe('add')
|
||||
// empty string in params will be filtered at: https://github.com/pnpm/pnpm/blob/main/pkg-manager/plugin-commands-installation/src/installDeps.ts#L196
|
||||
expect(params).toStrictEqual([''])
|
||||
})
|
||||
|
||||
test('should not swallows empty string in params', async () => {
|
||||
const { params, cmd } = await parseCliArgs({
|
||||
...DEFAULT_OPTS,
|
||||
}, ['run', 'echo', '', 'foo', '', 'bar'])
|
||||
expect(cmd).toBe('run')
|
||||
expect(params).toStrictEqual(['echo', '', 'foo', '', 'bar'])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user