-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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(file-list): Ensure duplicate files are handled properly #2255
Conversation
Previously, if files patterns amounted to duplicate files, the pattern resolution function would fail and Karma would continue on with an empty "included" files list. This led to confusing, generic adapter errors. This commit fixes that by replacing the offending code with a (likely) equivalent.
@dignifiedquire Sorry to pull you into this, I saw that you were involved in what could be a related issue. Would you happen to know what the intention of |
Thank you for figuring this out, the commit introducing the commit was db42a7f and the Probably the issue is that |
@dignifiedquire Thank you for the additional info, does normalizing the patterns before they are included in the lookup sound like a reasonable strategy to you? Something along the lines of:
|
@dignifiedquire I actually considered that, too. But, I don't fully understand the data flow in the system and thought that it would be risky to try to address the roots. However, if you're suggesting it, it makes me feel a bit more confident about that route — it seems to be more ideal. I thought about doing something along the lines of:
Is that what you had in mind? |
Sorry @m-a-r-c-e-l-i-n-o for not getting back on this earlier, I was away on a work trip and didn't have much time to look into this. It's important to get fixed properly so I will see that I can get you good answer by the end of today. |
After reading your comment, yes I think this is the right way to go. Have you tested if the issues in #2194 are going away after a fix like this? |
@dignifiedquire No worries. I just tested it and found two odd behaviors.
We need to understand this data flow a little better. Any thoughts? |
Thanks a lot, turns out I have to fix it in that nasty location as the adapters might be editing things directly. See my PR for a fix, which I will merge and release as soon as CI is happy. |
Previously, if file patterns amounted to duplicate files, the pattern resolution function would fail and Karma would continue on with an empty files list, namely "included". This led to confusing, generic adapter errors. This commit fixes that by replacing the offending code with a (likely) equivalent.
To replicate issue, include patterns that amount to duplicate files.
To see the error, wrap the following statement
if (other && other.compare(p) < 0) return
(contained insidefile-list.js
) in atry {} catch () {}
block. In essence,other.compare
does not exist.Might be related to issue #2194