Skip to content

Commit

Permalink
fix(core/config): Log cached repo config filename and content (#16134)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-Ladzaretti committed Jun 18, 2022
1 parent df70d37 commit 7f51e58
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/workers/repository/onboarding/branch/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export const isOnboarded = async (config: RenovateConfig): Promise<boolean> => {
configFileContent.renovate
) {
logger.debug('Existing config file confirmed');
logger.debug(
{ fileName: cache.configFileName, config: configFileContent },
'Repository config'
);
return true;
}
}
Expand Down
29 changes: 29 additions & 0 deletions lib/workers/repository/onboarding/branch/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
REPOSITORY_FORKED,
REPOSITORY_NO_PACKAGE_FILES,
} from '../../../../constants/error-messages';
import { logger } from '../../../../logger';
import type { Pr } from '../../../../modules/platform';
import { PrState } from '../../../../types';
import * as _cache from '../../../../util/cache/repository';
Expand Down Expand Up @@ -165,6 +166,19 @@ describe('workers/repository/onboarding/branch/index', () => {
cache.getCache.mockReturnValue({ configFileName: '.renovaterc' });
platform.getJsonFile.mockResolvedValueOnce({});
const res = await checkOnboardingBranch(config);
expect(logger.debug).toHaveBeenCalledWith(
'Checking cached config file name'
);
expect(logger.debug).toHaveBeenCalledWith(
'Existing config file confirmed'
);
expect(logger.debug).toHaveBeenCalledWith(
{
fileName: '.renovaterc',
config: {},
},
'Repository config'
);
expect(res.repoIsOnboarded).toBeTrue();
});

Expand All @@ -173,6 +187,21 @@ describe('workers/repository/onboarding/branch/index', () => {
platform.getJsonFile.mockResolvedValueOnce({ renovate: {} });
fs.readLocalFile.mockResolvedValueOnce('{}');
const res = await checkOnboardingBranch(config);
expect(logger.debug).toHaveBeenCalledWith(
'Checking cached config file name'
);
expect(logger.debug).toHaveBeenCalledWith(
'Existing config file confirmed'
);
expect(logger.debug).toHaveBeenCalledWith(
{
fileName: 'package.json',
config: {
renovate: {},
},
},
'Repository config'
);
expect(res.repoIsOnboarded).toBeTrue();
});

Expand Down

0 comments on commit 7f51e58

Please sign in to comment.