From 677a9732a6c79e684aad8c90c526e4f16504d7b7 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Tue, 14 Feb 2023 13:39:10 +0100 Subject: [PATCH] commitlint: subject-full-stop integration tests This rule was most of the time not working for us before, because of an upstream bug[1] which we have now fixed [2]. Given that a recent commit[3] upgraded our version of commitlint, we can just add integration tests now and we are done. [1] https://github.com/conventional-changelog/commitlint/issues/3530 [2] https://github.com/conventional-changelog/commitlint/pull/3531 [3] 1975174233f661d0adcd9799e7a8a5f656b19eb4 Co-authored-by: Zahra TehraniNasab --- commitlint.config.ts | 1 - commitlint/integration.test.ts | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/commitlint.config.ts b/commitlint.config.ts index 7cd76886..e404f0ce 100644 --- a/commitlint.config.ts +++ b/commitlint.config.ts @@ -54,7 +54,6 @@ module.exports = { // * Detect reverts which have not been elaborated. // * Reject some stupid obvious words: change, update, modify (if first word after colon, error; otherwise warning). // * Think of how to reject this shitty commit message: https://github.com/nblockchain/NOnion/pull/34/commits/9ffcb373a1147ed1c729e8aca4ffd30467255594 - // * Title should not have dot at the end. // * Workflow: detect if wip commit in a branch not named "wip/*" or whose name contains "squashed". // * Detect if commit hash mention in commit msg actually exists in repo. // * Detect scope(sub-scope) in the title that doesn't include scope part (e.g., writing (bar) instead of foo(bar)) diff --git a/commitlint/integration.test.ts b/commitlint/integration.test.ts index e9e82d9e..2dab17cb 100644 --- a/commitlint/integration.test.ts +++ b/commitlint/integration.test.ts @@ -12,3 +12,15 @@ test("body-leading-blank1", () => { let bodyLeadingBlank1 = runCommitLintOnMsg(commitMsgWithoutEmptySecondLine); expect(bodyLeadingBlank1.status).not.toBe(0); }); + +test("subject-full-stop1", () => { + let commitMsgWithEndingDotInTitle = "foo/bar: bla bla blah."; + let subjectFullStop1 = runCommitLintOnMsg(commitMsgWithEndingDotInTitle); + expect(subjectFullStop1.status).not.toBe(0); +}); + +test("subject-full-stop2", () => { + let commitMsgWithoutEndingDotInTitle = "foo/bar: bla bla blah"; + let subjectFullStop2 = runCommitLintOnMsg(commitMsgWithoutEndingDotInTitle); + expect(subjectFullStop2.status).toBe(0); +});