Skip to content

Commit

Permalink
feat(predicate): considered existance of renovate.json to be valid …
Browse files Browse the repository at this point in the history
…existing config
  • Loading branch information
travi committed Aug 30, 2023
1 parent 0d67af1 commit 2eec0e6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lift/predicate.js
Original file line number Diff line number Diff line change
@@ -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;
}
8 changes: 8 additions & 0 deletions src/lift/predicate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down

0 comments on commit 2eec0e6

Please sign in to comment.