-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix coverage paths sanitization issue #1411
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add unit tests for this?
Also, for the benefit of the future, could you please add content to the PR description with the bug you are working on and the theory behind the fix? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new test looks simple and direct - what I am not understanding is why the code doesn't pass that test before this change. Can you please explain that?
Since we are using file paths to match coverage of different files as strings the strings need to be exact matches, and some reporters can report in absolute paths instead of paths relative to project root or working directory. So we had this StripPrefix transformer in place, the issue with the existing implementation was that it was using strings as input and striping strings, which does not account for extra backslashes that might remain after striping base paths. For example, if you strip |
Attempt to fix #1392
As we can see in the image below of the coverage data in the issue, the file paths have the prefix
home/circleci/project/
in the coverage changes table, which I think are not matching with the files table computed from diff below causing this issue. This PR attempts to make existing path sanitization more robust and clear as the one we currently have as that seems error prone.