feat: remove the ignore-updates option

BREAKING CHANGE:
The option ignore-updates was removed
This commit is contained in:
TESTELIN Geoffrey
2021-10-08 18:06:39 +02:00
parent b98591d49e
commit 3021a55a47
10 changed files with 410 additions and 823 deletions

View File

@@ -47,8 +47,7 @@ export const DefaultProcessorOptions: IIssuesProcessorOptions = Object.freeze({
enableStatistics: true,
labelsToRemoveWhenUnstale: '',
labelsToAddWhenUnstale: '',
ignoreUpdates: false,
ignoreIssueUpdates: undefined,
ignorePrUpdates: undefined,
ignoreIssueUpdates: false,
ignorePrUpdates: false,
exemptDraftPr: false
});

View File

@@ -17,9 +17,25 @@ describe('ignore-updates options', (): void => {
sut.toIssue().staleIn(10).created(20).updated(5);
});
describe('when the ignore updates option is disabled', (): void => {
describe('when the ignore issue updates option is enabled', (): void => {
beforeEach((): void => {
sut.staleOnUpdates();
sut.ignoreIssueUpdates();
});
it('should stale the issue', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore issue updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnIssueUpdates();
});
it('should not stale the issue', async () => {
@@ -31,59 +47,11 @@ describe('ignore-updates options', (): void => {
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
describe('when the ignore issue updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignoreIssueUpdates();
});
it('should stale the issue', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore issue updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnIssueUpdates();
});
it('should not stale the issue', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(0);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore issue updates option is unset', (): void => {
beforeEach((): void => {
sut.unsetIgnoreIssueUpdates();
});
it('should not stale the issue', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(0);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
});
describe('when the ignore updates option is enabled', (): void => {
describe('when the ignore issue updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignoreUpdates();
sut.ignoreIssueUpdates();
});
it('should stale the issue', async () => {
@@ -95,53 +63,21 @@ describe('ignore-updates options', (): void => {
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore issue updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignoreIssueUpdates();
});
it('should stale the issue', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
describe('when the ignore issue updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnIssueUpdates();
});
describe('when the ignore issue updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnIssueUpdates();
});
it('should not stale the issue', async () => {
expect.assertions(3);
it('should not stale the issue', async () => {
expect.assertions(3);
await sut.test();
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(0);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore issue updates option is unset', (): void => {
beforeEach((): void => {
sut.unsetIgnoreIssueUpdates();
});
it('should stale the issue', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
expect(sut.processor.staleIssues).toHaveLength(0);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
});
@@ -151,9 +87,9 @@ describe('ignore-updates options', (): void => {
sut.toIssue().staleIn(10).created(20).updated(15);
});
describe('when the ignore updates option is disabled', (): void => {
describe('when the ignore issue updates option is enabled', (): void => {
beforeEach((): void => {
sut.staleOnUpdates();
sut.ignoreIssueUpdates();
});
it('should stale the issue', async () => {
@@ -165,59 +101,11 @@ describe('ignore-updates options', (): void => {
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
describe('when the ignore issue updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignoreIssueUpdates();
});
it('should stale the issue', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore issue updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnIssueUpdates();
});
it('should stale the issue', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore issue updates option is unset', (): void => {
beforeEach((): void => {
sut.unsetIgnoreIssueUpdates();
});
it('should stale the issue', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
});
describe('when the ignore updates option is enabled', (): void => {
describe('when the ignore issue updates option is disabled', (): void => {
beforeEach((): void => {
sut.ignoreUpdates();
sut.staleOnIssueUpdates();
});
it('should stale the issue', async () => {
@@ -229,53 +117,37 @@ describe('ignore-updates options', (): void => {
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore issue updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignoreIssueUpdates();
});
it('should stale the issue', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
describe('when the ignore issue updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignoreIssueUpdates();
});
describe('when the ignore issue updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnIssueUpdates();
});
it('should stale the issue', async () => {
expect.assertions(3);
it('should stale the issue', async () => {
expect.assertions(3);
await sut.test();
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
describe('when the ignore issue updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnIssueUpdates();
});
describe('when the ignore issue updates option is unset', (): void => {
beforeEach((): void => {
sut.unsetIgnoreIssueUpdates();
});
it('should stale the issue', async () => {
expect.assertions(3);
it('should stale the issue', async () => {
expect.assertions(3);
await sut.test();
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
});
@@ -285,9 +157,25 @@ describe('ignore-updates options', (): void => {
sut.toPullRequest().staleIn(10).created(20).updated(5);
});
describe('when the ignore updates option is disabled', (): void => {
describe('when the ignore pull request updates option is enabled', (): void => {
beforeEach((): void => {
sut.staleOnUpdates();
sut.ignorePullRequestUpdates();
});
it('should stale the pull request', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore pull request updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnPullRequestUpdates();
});
it('should not stale the pull request', async () => {
@@ -299,59 +187,11 @@ describe('ignore-updates options', (): void => {
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
describe('when the ignore pull request updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignorePullRequestUpdates();
});
it('should stale the pull request', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore pull request updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnPullRequestUpdates();
});
it('should not stale the pull request', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(0);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore pull request updates option is unset', (): void => {
beforeEach((): void => {
sut.unsetIgnorePullRequestUpdates();
});
it('should not stale the pull request', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(0);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
});
describe('when the ignore updates option is enabled', (): void => {
describe('when the ignore pull request updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignoreUpdates();
sut.ignorePullRequestUpdates();
});
it('should stale the pull request', async () => {
@@ -363,53 +203,21 @@ describe('ignore-updates options', (): void => {
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore pull request updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignorePullRequestUpdates();
});
it('should stale the pull request', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
describe('when the ignore pull request updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnPullRequestUpdates();
});
describe('when the ignore pull request updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnPullRequestUpdates();
});
it('should not stale the pull request', async () => {
expect.assertions(3);
it('should not stale the pull request', async () => {
expect.assertions(3);
await sut.test();
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(0);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore pull request updates option is unset', (): void => {
beforeEach((): void => {
sut.unsetIgnorePullRequestUpdates();
});
it('should stale the pull request', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
expect(sut.processor.staleIssues).toHaveLength(0);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
});
@@ -419,9 +227,9 @@ describe('ignore-updates options', (): void => {
sut.toPullRequest().staleIn(10).created(20).updated(15);
});
describe('when the ignore updates option is disabled', (): void => {
describe('when the ignore pull request updates option is enabled', (): void => {
beforeEach((): void => {
sut.staleOnUpdates();
sut.ignorePullRequestUpdates();
});
it('should stale the pull request', async () => {
@@ -433,59 +241,11 @@ describe('ignore-updates options', (): void => {
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
describe('when the ignore pull request updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignorePullRequestUpdates();
});
it('should stale the pull request', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore pull request updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnPullRequestUpdates();
});
it('should stale the pull request', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore pull request updates option is unset', (): void => {
beforeEach((): void => {
sut.unsetIgnorePullRequestUpdates();
});
it('should stale the pull request', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
});
describe('when the ignore updates option is enabled', (): void => {
describe('when the ignore pull request updates option is disabled', (): void => {
beforeEach((): void => {
sut.ignoreUpdates();
sut.staleOnPullRequestUpdates();
});
it('should stale the pull request', async () => {
@@ -497,53 +257,37 @@ describe('ignore-updates options', (): void => {
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
describe('when the ignore pull request updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignorePullRequestUpdates();
});
it('should stale the pull request', async () => {
expect.assertions(3);
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
describe('when the ignore pull request updates option is enabled', (): void => {
beforeEach((): void => {
sut.ignorePullRequestUpdates();
});
describe('when the ignore pull request updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnPullRequestUpdates();
});
it('should stale the pull request', async () => {
expect.assertions(3);
it('should stale the pull request', async () => {
expect.assertions(3);
await sut.test();
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
describe('when the ignore pull request updates option is disabled', (): void => {
beforeEach((): void => {
sut.staleOnPullRequestUpdates();
});
describe('when the ignore pull request updates option is unset', (): void => {
beforeEach((): void => {
sut.unsetIgnorePullRequestUpdates();
});
it('should stale the pull request', async () => {
expect.assertions(3);
it('should stale the pull request', async () => {
expect.assertions(3);
await sut.test();
await sut.test();
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
expect(sut.processor.staleIssues).toHaveLength(1);
expect(sut.processor.closedIssues).toHaveLength(0);
expect(sut.processor.removedLabelIssues).toHaveLength(0);
});
});
});
@@ -594,22 +338,6 @@ class SUT {
return this;
}
ignoreUpdates(): SUT {
this._updateOptions({
ignoreUpdates: true
});
return this;
}
staleOnUpdates(): SUT {
this._updateOptions({
ignoreUpdates: false
});
return this;
}
ignoreIssueUpdates(): SUT {
this._updateOptions({
ignoreIssueUpdates: true
@@ -626,14 +354,6 @@ class SUT {
return this;
}
unsetIgnoreIssueUpdates(): SUT {
this._updateOptions({
ignoreIssueUpdates: undefined
});
return this;
}
ignorePullRequestUpdates(): SUT {
this._updateOptions({
ignorePrUpdates: true
@@ -650,14 +370,6 @@ class SUT {
return this;
}
unsetIgnorePullRequestUpdates(): SUT {
this._updateOptions({
ignorePrUpdates: undefined
});
return this;
}
async test(): Promise<number> {
return this._setTestIssueList()._setProcessor();
}