Repository navigation
test(ensure): pin case conversion of digits, punctuation and accents - #5055
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
🟢 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.
|
4 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
@commitlint/ensure/src/to-case.test.ts: a table of inputs and their current output forcamel-case,kebab-case,snake-case,pascal-caseandstart-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
es2015converts toes-2015in kebab-case, so a scopees2015failsscope-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
toCasehad no test file, andcase.test.tshas no inputs with digits, punctuation or accents. #5051 swapped the string library behindtoCase, which changed 280 of 710 sampled conversions and flipped 101 rule verdicts, with all 1259 tests still passing. For example:feat(es2015): add thingscope-casealwayskebab-casefeat: oauth2subject-caseneverkebab-caseWith 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 lintandpnpm formatpass. I did not re-run the full suite, since nothing outside the new test file changed.Types of changes
Tests only, so none of the boxes apply.
Checklist:
🤖 Generated with Claude Code