diff --git a/lib/helpers/yarn.js b/lib/helpers/yarn.js index 254ed8ce7d4692e23ac522b8a3b4b02bc49d6bb0..1dfc24f75c3947e071d487d82e1e5e504dbe5d13 100644 --- a/lib/helpers/yarn.js +++ b/lib/helpers/yarn.js @@ -89,9 +89,13 @@ async function maintainLockFile(inputConfig) { 'yarn.lock' ); logger.debug(`Checking for ${yarnLockFileName}`); - const existingYarnLock = await inputConfig.api.getFileContent( - yarnLockFileName + let existingYarnLock = await inputConfig.api.getFileContent( + yarnLockFileName, + inputConfig.branchName ); + if (!existingYarnLock) { + existingYarnLock = await inputConfig.api.getFileContent(yarnLockFileName); + } logger.silly(`existingYarnLock:\n${existingYarnLock}`); if (!existingYarnLock) { return null; diff --git a/test/helpers/yarn.spec.js b/test/helpers/yarn.spec.js index 8ba85f918caad1b174188ca83418cebe7d8211ef..7fc737a4408796e73262c8208d8d7a29d4f926a8 100644 --- a/test/helpers/yarn.spec.js +++ b/test/helpers/yarn.spec.js @@ -69,7 +69,7 @@ describe('maintainLockFile(inputConfig)', () => { }); it('returns null if no file to maintain', async () => { const yarnLock = await yarnHelper.maintainLockFile(config); - expect(config.api.getFileContent.mock.calls.length).toBe(2); + expect(config.api.getFileContent.mock.calls.length).toBe(3); expect(yarnLock).toEqual(null); }); it('returns null if contents match', async () => {