diff --git a/lib/workers/branch/__snapshots__/get-updated.spec.ts.snap b/lib/workers/branch/__snapshots__/get-updated.spec.ts.snap index e751ab26d1c2bd0590f046f2ceff93a1feb7eb93..1917689508f564826b7dcf032a3b9d3e84ecf1d8 100644 --- a/lib/workers/branch/__snapshots__/get-updated.spec.ts.snap +++ b/lib/workers/branch/__snapshots__/get-updated.spec.ts.snap @@ -139,3 +139,22 @@ Object { "updatedPackageFiles": Array [], } `; + +exports[`workers/branch/get-updated getUpdatedPackageFiles() update artifacts on update-lockfile strategy 1`] = ` +Object { + "artifactErrors": Array [], + "reuseExistingBranch": undefined, + "updatedArtifacts": Array [ + Object { + "contents": "some contents", + "name": "composer.lock", + }, + ], + "updatedPackageFiles": Array [ + Object { + "contents": "existing content", + "name": "undefined", + }, + ], +} +`; diff --git a/lib/workers/branch/get-updated.spec.ts b/lib/workers/branch/get-updated.spec.ts index 70e12e2a885e2f7f1019f8f18fcbb1c97fa11e6d..2fcf25c41a7e1e98fe007cbde2976365ff96854c 100644 --- a/lib/workers/branch/get-updated.spec.ts +++ b/lib/workers/branch/get-updated.spec.ts @@ -151,5 +151,23 @@ describe('workers/branch/get-updated', () => { const res = await getUpdatedPackageFiles(config); expect(res).toMatchSnapshot(); }); + it('update artifacts on update-lockfile strategy', async () => { + config.upgrades.push({ + manager: 'composer', + branchName: undefined, + rangeStrategy: 'update-lockfile', + }); + autoReplace.doAutoReplace.mockResolvedValueOnce('existing content'); + composer.updateArtifacts.mockResolvedValueOnce([ + { + file: { + name: 'composer.lock', + contents: 'some contents', + }, + }, + ]); + const res = await getUpdatedPackageFiles(config); + expect(res).toMatchSnapshot(); + }); }); }); diff --git a/lib/workers/branch/get-updated.ts b/lib/workers/branch/get-updated.ts index d922990984ac7155752d3f719496353d0f40c0d8..233d3585b2ccb202b76984b17402e87c70c2e4ff 100644 --- a/lib/workers/branch/get-updated.ts +++ b/lib/workers/branch/get-updated.ts @@ -65,6 +65,10 @@ export async function getUpdatedPackageFiles( if (res) { if (res === existingContent) { logger.debug({ packageFile, depName }, 'No content changed'); + if (upgrade.rangeStrategy === 'update-lockfile') { + logger.debug({ packageFile, depName }, 'update-lockfile add'); + updatedFileContents[packageFile] = res; + } } else { logger.debug({ packageFile, depName }, 'Contents updated'); updatedFileContents[packageFile] = res; @@ -117,7 +121,9 @@ export async function getUpdatedPackageFiles( } if ( newContent === existingContent && - upgrade.datasource === datasourceGitSubmodules.id + (upgrade.datasource === + datasourceGitSubmodules.id /* istanbul ignore next: no manager to test this exists */ || + upgrade.rangeStrategy === 'update-lockfile') ) { updatedFileContents[packageFile] = newContent; }