mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-28 03:51:40 -04:00
34 lines
852 B
TypeScript
34 lines
852 B
TypeScript
import { getOptionsFromPnpmSettings } from '../lib/getOptionsFromRootManifest.js'
|
|
|
|
const ORIGINAL_ENV = process.env
|
|
|
|
afterEach(() => {
|
|
process.env = { ...ORIGINAL_ENV }
|
|
})
|
|
|
|
test('getOptionsFromPnpmSettings() replaces env variables in settings', () => {
|
|
process.env.PNPM_TEST_KEY = 'foo'
|
|
process.env.PNPM_TEST_VALUE = 'bar'
|
|
const options = getOptionsFromPnpmSettings(process.cwd(), {
|
|
'${PNPM_TEST_KEY}': '${PNPM_TEST_VALUE}',
|
|
} as any) as any // eslint-disable-line
|
|
expect(options.foo).toBe('bar')
|
|
})
|
|
|
|
test('getOptionsFromPnpmSettings() converts allowBuilds', () => {
|
|
const options = getOptionsFromPnpmSettings(process.cwd(), {
|
|
allowBuilds: {
|
|
foo: true,
|
|
bar: false,
|
|
qar: 'warn',
|
|
},
|
|
})
|
|
expect(options).toStrictEqual({
|
|
allowBuilds: {
|
|
foo: true,
|
|
bar: false,
|
|
qar: 'warn',
|
|
},
|
|
})
|
|
})
|