Skip to content

test(ensure): pin case conversion of digits, punctuation and accents - #5055

Merged
escapedcat merged 1 commit into
masterfrom
test/ensure-to-case-characterization
Oct 13, 2026
Merged

escapedcat merged 1 commit into
masterfrom
test/ensure-to-case-characterization

Conversation

@escapedcat

Copy link
Copy Markdown
Member

Description

Adds @commitlint/ensure/src/to-case.test.ts: a table of inputs and their current output for camel-case, kebab-case, snake-case, pascal-case and start-case, plus one check each for the upper, lower and sentence variants and the unknown-target error.

These are characterization tests. They record what 21.2.3 does today, not what would be ideal. For example es2015 converts to es-2015 in kebab-case, so a scope es2015 fails scope-case: kebab-case. Whether that should change is a separate decision; this only makes sure it cannot change by accident.

No implementation change.

Motivation and Context

toCase had no test file, and case.test.ts has no inputs with digits, punctuation or accents. #5051 swapped the string library behind toCase, which changed 280 of 710 sampled conversions and flipped 101 rule verdicts, with all 1259 tests still passing. For example:

Commit Rule 21.2.3 With #5051
feat(es2015): add thing scope-case always kebab-case invalid valid
feat: oauth2 subject-case never kebab-case valid invalid

With this table in place, a change like that fails the suite.

Usage examples

None; tests only.

How Has This Been Tested?

The expected values were generated from the current implementation on master. The new file passes (34 tests); pnpm lint and pnpm format pass. I did not re-run the full suite, since nothing outside the new test file changed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Tests only, so none of the boxes apply.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have verified that any documentation examples I added/changed actually work.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • For a feature/bug fix, my commits follow the test-driven flow: a failing-test commit, then the implementation.

🤖 Generated with Claude Code

Characterization tests for toCase. The existing case tests had no inputs
with digits, punctuation or accents, so swapping the string library
could change rule verdicts with the whole suite still green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The tests accurately cover the current implementation without changing production behavior.

0 open findings

What changed in this PR

Adds characterization coverage for toCase to prevent accidental conversion changes.

Changes:

  • Pins digit, punctuation, accent, separator, and word-boundary behavior.
  • Covers aliases and unknown-target errors.
File Description
@commitlint/​ensure/​src/​to-case.test.ts Adds comprehensive conversion characterization tests.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low impact] This test-only PR appears safe to merge.

Reviews (1) · Last reviewed commit: "test(ensure): pin case conversion of dig..." · Reviewed by Greptile

@escapedcat
escapedcat added this pull request to the merge queue Oct 13, 2026
Merged via the queue into master with commit ed33ff4 Oct 13, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants