Add custom sanitization map to test CLI for test-specific output rules#1779
Merged
Add custom sanitization map to test CLI for test-specific output rules#1779
Conversation
…t rules Add a new `sanitize` field to the test expectations that allows tests to specify custom regex replacement patterns for one-off sanitization cases that don't need global rules. This is useful for sanitizing session IDs, build timestamps, or other test-specific volatile values. Changes: - Add sanitizeOption functional options pattern to sanitizeOutput function - Add WithCustomReplacements() option builder for custom patterns - Add sanitize field to Expectation struct for test case YAML configuration - Update schema.json to validate sanitize field in test cases - Integrate custom sanitization into verifySnapshot() workflow - Add 14 comprehensive test cases covering all sanitization scenarios - Add detailed README documentation with examples and debugging tips The implementation follows the mandatory functional options pattern from CLAUDE.md and maintains backward compatibility with existing tests. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
|
💥 This pull request now has conflicts. Could you fix it @osterman? 🙏 |
Resolved conflict in tests/cli_test.go by combining: - Custom sanitization map logic from custom-sanitize-map branch - Additional path normalization patterns from main branch Both features are now integrated sequentially in the sanitizeOutput function.
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1779 +/- ##
==========================================
- Coverage 70.73% 70.72% -0.01%
==========================================
Files 432 432
Lines 39916 39916
==========================================
- Hits 28235 28232 -3
- Misses 9277 9282 +5
+ Partials 2404 2402 -2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
aknysh
approved these changes
Nov 11, 2025
aknysh
added a commit
that referenced
this pull request
Nov 11, 2025
Resolved snapshot conflicts by taking main's version. User will regenerate snapshots as needed for ai-1 branch changes. Merged changes from main: - feat: add error handling infrastructure with context-aware capabilities (#1763) - fix: Resolve changelog check failures on large PRs (#1782) - Refine homepage hero and typing animation (#1781) - fix: Reduce log spam for imports outside base directory (#1780) - feat: Add custom sanitization map to test CLI for test-specific output rules (#1779) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
These changes were released in v1.199.0-rc.0. |
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.
This PR introduces a custom sanitization map for the test CLI to enable test-specific output rules. The implementation adds comprehensive test coverage for path sanitization across different formats (Unix, Windows, debug logs) and standardizes snapshot testing behavior.
Tests verify sanitization of absolute paths, Windows-style backslashes, debug logs with import prefixes, multiple occurrences, and path normalization. Documentation updates explain the sanitization testing strategy.
Closes #[issue-number]