Skip to content
Snippets Groups Projects
Commit 430c0552 authored by Michael Kriese's avatar Michael Kriese Committed by Rhys Arkins
Browse files

fix(worker): no config error on dryRun (#4054)

parent 0d2427a0
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,11 @@ async function raiseConfigWarningIssue(config, error) {
logger.info('Updating onboarding PR with config error notice');
body = `## Action Required: Fix ${appName} Configuration\n\n${body}`;
body += `\n\nOnce you have resolved this problem (in this onboarding branch), ${appName} will return to providing you with a preview of your repository's configuration.`;
await platform.updatePr(pr.number, onboardingPrTitle, body);
if (config.dryRun) {
logger.info('DRY-RUN: Would update PR #' + pr.number);
} else await platform.updatePr(pr.number, onboardingPrTitle, body);
} else if (config.dryRun) {
logger.info('DRY-RUN: Would ensure config error issue');
} else {
const res = await platform.ensureIssue(
`Action Required: Fix ${appName} Configuration`,
......
......@@ -18,6 +18,17 @@ describe('workers/repository/error-config', () => {
const res = await raiseConfigWarningIssue(config, error);
expect(res).toBeUndefined();
});
it('creates issues (dryRun)', async () => {
const error = new Error('config-validation');
error.configFile = 'package.json';
error.validationMessage = 'some-message';
platform.ensureIssue.mockReturnValue('created');
const res = await raiseConfigWarningIssue(
{ ...config, dryRun: true },
error
);
expect(res).toBeUndefined();
});
it('handles onboarding', async () => {
const error = new Error('config-validation');
error.configFile = 'package.json';
......@@ -26,5 +37,16 @@ describe('workers/repository/error-config', () => {
const res = await raiseConfigWarningIssue(config, error);
expect(res).toBeUndefined();
});
it('handles onboarding (dryRun)', async () => {
const error = new Error('config-validation');
error.configFile = 'package.json';
error.validationMessage = 'some-message';
platform.getBranchPr.mockReturnValueOnce({ number: 1, state: 'open' });
const res = await raiseConfigWarningIssue(
{ ...config, dryRun: true },
error
);
expect(res).toBeUndefined();
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment