Skip to content
Snippets Groups Projects
Commit ced374ea authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: disable manager if parentManager is disabled

Closes #1778
parent ba98e7dc
No related branches found
No related tags found
No related merge requests found
...@@ -57,6 +57,11 @@ async function detectPackageFiles(config) { ...@@ -57,6 +57,11 @@ async function detectPackageFiles(config) {
logger.debug(manager + ' is disabled'); logger.debug(manager + ' is disabled');
continue; // eslint-disable-line no-continue continue; // eslint-disable-line no-continue
} }
// Check if the parent is manually disabled
if (parentManager && config[parentManager].enabled === false) {
logger.debug(manager + ' parentManager is disabled');
continue; // eslint-disable-line no-continue
}
let files = []; let files = [];
if (managers[manager].detectPackageFiles) { if (managers[manager].detectPackageFiles) {
logger.debug('manager has own detect function'); logger.debug('manager has own detect function');
......
...@@ -16,7 +16,7 @@ describe('manager', () => { ...@@ -16,7 +16,7 @@ describe('manager', () => {
let config; let config;
beforeEach(() => { beforeEach(() => {
config = { config = {
...defaultConfig, ...JSON.parse(JSON.stringify(defaultConfig)),
warnings: [], warnings: [],
}; };
}); });
...@@ -29,6 +29,15 @@ describe('manager', () => { ...@@ -29,6 +29,15 @@ describe('manager', () => {
const res = await manager.detectPackageFiles(config); const res = await manager.detectPackageFiles(config);
expect(res).toHaveLength(0); expect(res).toHaveLength(0);
}); });
it('skips if parentManager is disabled', async () => {
platform.getFileList.mockReturnValueOnce([
'package.json',
'.circleci/config.yml',
]);
config.docker.enabled = false;
const res = await manager.detectPackageFiles(config);
expect(res).toHaveLength(1);
});
it('adds package files to object', async () => { it('adds package files to object', async () => {
platform.getFileList.mockReturnValueOnce([ platform.getFileList.mockReturnValueOnce([
'package.json', 'package.json',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment