From 2eec0e689ef9112b5eb607c0eb503cefc3898a7a Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Tue, 29 Aug 2023 22:29:22 -0500 Subject: [PATCH] feat(predicate): considered existance of `renovate.json` to be valid existing config --- src/lift/predicate.js | 9 +++++++-- src/lift/predicate.test.js | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lift/predicate.js b/src/lift/predicate.js index 16f2f689..8f2ee6cd 100644 --- a/src/lift/predicate.js +++ b/src/lift/predicate.js @@ -1,5 +1,10 @@ import {fileExists} from '@form8ion/core'; -export default function ({projectRoot}) { - return fileExists(`${projectRoot}/.renovaterc.json`); +export default async function ({projectRoot}) { + const [configExists, legacyConfigExists] = await Promise.all([ + fileExists(`${projectRoot}/.renovaterc.json`), + fileExists(`${projectRoot}/renovate.json`) + ]); + + return configExists || legacyConfigExists; } diff --git a/src/lift/predicate.test.js b/src/lift/predicate.test.js index d8ce5df8..b2ca7d5d 100644 --- a/src/lift/predicate.test.js +++ b/src/lift/predicate.test.js @@ -21,8 +21,16 @@ describe('lift predicate', () => { expect(await shouldBeLifted({projectRoot})).toBe(true); }); + it('should lift the project if it has a legacy renovate config file', async () => { + when(fileExists).calledWith(`${projectRoot}/.renovaterc.json`).mockResolvedValue(false); + when(fileExists).calledWith(`${projectRoot}/renovate.json`).mockResolvedValue(true); + + expect(await shouldBeLifted({projectRoot})).toBe(true); + }); + it('should not lift the project if it does not has a renovate config file', async () => { when(fileExists).calledWith(`${projectRoot}/.renovaterc.json`).mockResolvedValue(false); + when(fileExists).calledWith(`${projectRoot}/renovate.json`).mockResolvedValue(false); expect(await shouldBeLifted({projectRoot})).toBe(false); });