summaryrefslogtreecommitdiff
path: root/tests/conventional-commits.test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/conventional-commits.test.sh')
-rwxr-xr-xtests/conventional-commits.test.sh18
1 files changed, 4 insertions, 14 deletions
diff --git a/tests/conventional-commits.test.sh b/tests/conventional-commits.test.sh
index 042b819..12c1f46 100755
--- a/tests/conventional-commits.test.sh
+++ b/tests/conventional-commits.test.sh
@@ -8,7 +8,6 @@ cd "$ROOT"
fail() { echo "FAIL: $*" >&2; exit 1; }
pass() { echo "ok: $*"; }
-# Same rule as scripts/lib/note-helpers.mjs isConventionalCommitSubject
RE='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-zA-Z0-9._/-]+\))?!?: .+'
mapfile -t SUBJECTS < <(git log --format=%s)
@@ -25,18 +24,9 @@ for s in "${SUBJECTS[@]}"; do
done
[[ "$bad" -eq 0 ]] || fail "one or more commits are not Conventional Commits"
-# Unit helper agrees with git history
-node --input-type=module -e '
-import { isConventionalCommitSubject } from "./scripts/lib/note-helpers.mjs";
-import { execSync } from "node:child_process";
-const subjects = execSync("git log --format=%s", { encoding: "utf8" })
- .trim().split("\n").filter(Boolean);
-for (const s of subjects) {
- if (!isConventionalCommitSubject(s)) {
- console.error("helper rejected:", s);
- process.exit(1);
- }
-}
-'
+# Cross-check with Rust helper unit tests
+out="$(cargo test -q --lib helpers::tests::conventional_subjects -- --exact 2>&1)"
+echo "$out"
+echo "$out" | rg -q '1 passed' || fail "Rust conventional_subjects test did not run/pass"
echo "All conventional-commit checks passed."