Add 23 new tests covering previously untested functionality:
- Wildcard namespace matching (simple, middle, multiple wildcards)
- Exclusion patterns (single, wildcard, precedence over names)
- Multiple namespace delimiters (commas, spaces, whitespace trimming)
- enabled() function (empty state, exact match, wildcard, skip)
- coerce() function (Error with stack, Error without stack, non-Error)
- selectColor() consistency and color pool membership
- Format string handling (%% escape, non-string args, custom formatters)
What
Added 23 new tests covering previously untested core functionality, bringing test count from 16 to 39.
Why
While working with debug in my Express middleware, I noticed several core functions had no direct test coverage. The matchesTemplate function (which replaced the old regex-based approach) is central to how namespace matching works, yet had zero dedicated tests. Same for coerce, selectColor, and the format string processing logic.
New test coverage
Wildcard namespace matching (11 tests)
enabled() function (4 tests)
coerce() function (3 tests)
selectColor() (2 tests)
Format string handling (3 tests)
Testing
All existing tests continue to pass. No source code changes — tests only.
Note: The linter (xo) currently fails on both master and this branch due to util.isDate being removed in Node.js 24. This is a pre-existing issue unrelated to these changes.