diff --git a/lib/workers/repository/update/branch/get-updated.spec.ts b/lib/workers/repository/update/branch/get-updated.spec.ts index 123485920d9c87..04a20633fd11a2 100644 --- a/lib/workers/repository/update/branch/get-updated.spec.ts +++ b/lib/workers/repository/update/branch/get-updated.spec.ts @@ -205,6 +205,81 @@ describe('workers/repository/update/branch/get-updated', () => { }); }); + it('for updatedArtifacts passes proper lockFiles', async () => { + config.upgrades.push({ + packageFile: 'composer.json', + manager: 'composer', + branchName: '', + }); + config.lockFiles = ['different.lock']; + config.packageFiles = { + composer: [ + { + packageFile: 'composer.json', + lockFiles: ['composer.lock'], + deps: [], + }, + ] satisfies PackageFile[], + }; + autoReplace.doAutoReplace.mockResolvedValueOnce('some new content'); + composer.updateArtifacts.mockResolvedValueOnce([ + { + file: { + type: 'addition', + path: 'composer.lock', + contents: 'some contents', + }, + }, + ]); + await getUpdatedPackageFiles(config); + expect(composer.updateArtifacts).toHaveBeenCalledWith( + expect.objectContaining({ + config: expect.objectContaining({ + lockFiles: ['composer.lock'], + }), + }), + ); + }); + + it('for nonUpdatedArtifacts passes proper lockFiles', async () => { + config.upgrades.push({ + packageFile: 'composer.json', + manager: 'composer', + branchName: '', + isLockfileUpdate: true, + }); + composer.updateLockedDependency.mockReturnValueOnce({ + status: 'unsupported', + }); + config.lockFiles = ['different.lock']; + config.packageFiles = { + composer: [ + { + packageFile: 'composer.json', + lockFiles: ['composer.lock'], + deps: [], + }, + ] satisfies PackageFile[], + }; + composer.updateArtifacts.mockResolvedValueOnce([ + { + file: { + type: 'addition', + path: 'composer.lock', + contents: 'some contents', + }, + }, + ]); + await getUpdatedPackageFiles(config); + expect(composer.updateArtifacts).toHaveBeenCalledWith( + expect.objectContaining({ + config: expect.objectContaining({ + lockFiles: ['composer.lock'], + }), + }), + ); + }); + it('for lockFileMaintenance passes proper lockFiles', async () => { config.upgrades.push({ manager: 'composer', diff --git a/lib/workers/repository/update/branch/get-updated.ts b/lib/workers/repository/update/branch/get-updated.ts index b036b178d9a621..c79924d2edd274 100644 --- a/lib/workers/repository/update/branch/get-updated.ts +++ b/lib/workers/repository/update/branch/get-updated.ts @@ -302,7 +302,11 @@ export async function getUpdatedPackageFiles( updatedDeps, // TODO #22198 newPackageFileContent: packageFile.contents!.toString(), - config, + config: patchConfigForArtifactsUpdate( + config, + manager, + packageFile.path, + ), }); processUpdateArtifactResults(results, updatedArtifacts, artifactErrors); } @@ -329,7 +333,11 @@ export async function getUpdatedPackageFiles( updatedDeps, // TODO #22198 newPackageFileContent: packageFile.contents!.toString(), - config, + config: patchConfigForArtifactsUpdate( + config, + manager, + packageFile.path, + ), }); processUpdateArtifactResults(results, updatedArtifacts, artifactErrors); if (is.nonEmptyArray(results)) {