Files
pnpm/config/reader/test/getOptionsFromRootManifest.test.ts
Zoltan Kochan 303ca410f5 feat!: stop reading settings from the pnpm field of package.json (#10086)
Settings should be read from pnpm-workspace.yaml
2026-03-18 14:46:07 +01:00

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',
},
})
})