diff --git a/lib/modules/manager/npm/post-update/lerna.spec.ts b/lib/modules/manager/npm/post-update/lerna.spec.ts index f061b4344f78d1385ae4c020b0b2f0b934094d5d..c56f39a345b99f56008411b2c7f3a88fd938ff66 100644 --- a/lib/modules/manager/npm/post-update/lerna.spec.ts +++ b/lib/modules/manager/npm/post-update/lerna.spec.ts @@ -219,7 +219,9 @@ describe('modules/manager/npm/post-update/lerna', () => { it('returns specified version', () => { const pkg = {}; expect( - lernaHelper.getLernaVersion(pkg, { engines: { lerna: '2.0.0' } }) + lernaHelper.getLernaVersion(pkg, { + devDependencies: { lerna: '2.0.0' }, + }) ).toBe('2.0.0'); }); @@ -227,7 +229,7 @@ describe('modules/manager/npm/post-update/lerna', () => { const pkg = {}; expect( lernaHelper.getLernaVersion(pkg, { - engines: { lerna: '1.x || >=2.5.0 || 5.0.0 - 7.2.3' }, + dependencies: { lerna: '1.x || >=2.5.0 || 5.0.0 - 7.2.3' }, }) ).toBe('1.x || >=2.5.0 || 5.0.0 - 7.2.3'); }); diff --git a/lib/modules/manager/npm/post-update/lerna.ts b/lib/modules/manager/npm/post-update/lerna.ts index f65a052d477177cff0ef13dbeeb681b264b69853..0557889be0622572239d0dcb9efa07fd436e5ea9 100644 --- a/lib/modules/manager/npm/post-update/lerna.ts +++ b/lib/modules/manager/npm/post-update/lerna.ts @@ -24,9 +24,10 @@ import { getPackageManagerVersion, lazyLoadPackageJson } from './utils'; // Exported for testability export function getLernaVersion( lernaPackageFile: Partial<PackageFile<NpmManagerData>>, - lazyPgkJson: PackageJsonSchema + lazyPkgJson: PackageJsonSchema ): string | null { - const constraint = getPackageManagerVersion('lerna', lazyPgkJson); + const constraint = + lazyPkgJson.dependencies?.lerna ?? lazyPkgJson.devDependencies?.lerna; if (!constraint || !semver.validRange(constraint)) { logger.warn( // TODO: types (#7154)