mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-27 18:46:18 -04:00
fix: pnpm config get <key> -g returns empty when the value is a boolean (#6360)
This commit is contained in:
5
.changeset/little-badgers-sort.md
Normal file
5
.changeset/little-badgers-sort.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-config": patch
|
||||
---
|
||||
|
||||
`pnpm config get <key>` returns empty when the value is a boolean
|
||||
@@ -1,5 +1,6 @@
|
||||
import { type ConfigCommandOptions } from './ConfigCommandOptions'
|
||||
|
||||
export function configGet (opts: ConfigCommandOptions, key: string) {
|
||||
return opts.rawConfig[key]
|
||||
const config = opts.rawConfig[key]
|
||||
return typeof config === 'boolean' ? config.toString() : config
|
||||
}
|
||||
|
||||
@@ -13,3 +13,17 @@ test('config get', async () => {
|
||||
|
||||
expect(configKey).toEqual('~/store')
|
||||
})
|
||||
|
||||
test('config get a boolean should return string format', async () => {
|
||||
const configKey = await config.handler({
|
||||
dir: process.cwd(),
|
||||
cliOptions: {},
|
||||
configDir: process.cwd(),
|
||||
global: true,
|
||||
rawConfig: {
|
||||
'update-notifier': true,
|
||||
},
|
||||
}, ['get', 'update-notifier'])
|
||||
|
||||
expect(configKey).toEqual('true')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user