-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Test edge cases #82
Test edge cases #82
Conversation
Edge cases for the edge-case-god. Let's wait on these until some of the other issues are solved. I might be removing |
Fair enough, that sounds good. |
@erikkemperman could you rebase this and update to the new style of tests in master? Thanks! |
@phated Yup, will do just as soon as I have some time! |
a33802b
to
b6e4955
Compare
@phated Rebased and restyled... Still passing on Travis, but still failing on AppVeyor. Can't dig into that further though, for lack of a windows box. |
b6e4955
to
5fd52e3
Compare
Thanks! cc'ing @jonschlinkert and @doowb about this, maybe they can help since we are keeping |
I'll be able to take a look and debug on a windows machine over the next few days. |
@doowb perfect, that's the timeframe I'm looking at for the next glob-stream major. |
test/main.js
Outdated
} | ||
|
||
pipe([ | ||
globStream(['*', '!!(case)'], { cwd: cwd }), |
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.
a double !
would be recognized as an inclusive/positive matcher by minimatch. From the minimatch readme
Multiple
!
characters at the start of a pattern will negate the pattern multiple times.
edit: for that pattern to work as a negation pattern, I believe you would also need to set nonegate
to true. But I'm not completely sure how minimatch works for that
edit2: nvm ignore my comments. I thought the test was saying "should ignore file" but it's saying "should ignore pattern" which seems to be exactly correct. so it's doing the right thing I think.
I'm still reviewing... I haven't seen anything else stand out yet, I'll comment back if I do
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.
From earlier discussion I took this syntax to mean "ignore everything matching this negative extglob", which is what it tests
All of these pass on Travis, but not on Appveyor. I'm thinking slashes get parsed as separators, but am not equipped to debug on windows...
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.
I just finished running the tests on Windows 8, Windows 10 and mac with node.js 6 and the current version, and everything is passing 100%. I also logged out the paths created for the failing unit tests, and everything looks correct to me.
I'm waiting for nvm to finish installing on my windows box so I can test other versions. I'll update here when I get those results.
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.
I don't see the added tests in that output (?)
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.
Thanks, I just noticed the same thing -- but accidentally started a review or something. Tired fingers on tiny mobile screen, sorry about that.
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.
Yeah that was my original guess, slashes parsed as separators on windows. Sorry I'm not able to track this down myself, sounds like I'm claiming a lot of your time...
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.
oh no worries, I don't mind. This windows path stuff can be difficult to debug, I love being a part of a community where other devs can help me figure this stuff out. I'm happy to help where I can
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.
quick update. I tried for a couple of hours to get nvm-windows working on my windows box with no luck. I don't think it was a windows-nvm issue, but I'm going to try again tomorrow and let you know once I get these tests running on different versions. Unless someone has a better suggestion for testing node.js versions on windows.
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.
@jonschlinkert I'm not sure this is a node version issue, it seems to be failing on every version.
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.
Side note: this test seems to be passing on Appveyor, if I'm reading the results correctly.
@doowb any luck debugging? I'm getting super close to cutting the 6.0 release of glob-stream. |
test/main.js
Outdated
], done); | ||
}); | ||
|
||
it('should handle pattern starting with exclam and paren', function(done) { |
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.
@jonschlinkert @doowb this seems to be one of the failing tests
test/main.js
Outdated
], done); | ||
}); | ||
|
||
it('should ignore pattern starting with exclam and paren', function(done) { |
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.
@jonschlinkert @doowb this seems to be the other failing test
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.
yeah they're both essentially the same issue. I believe node-glob or minimatch strips escaping and/or normalize all \\
to /
, so no matter how we do the pattern there it won't work. But I can't get nvm working on windows to confirm.
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.
and if it's not that, then it's probably how the tests are designed. If node-glob doesn't normalize slashes then wouldn't we need to do double backslashes on windows? Otherwise the current escaping would be recognized as a path separator.
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.
I was thinking it might be https://www.npmjs.com/package/glob-parent#windows (mentioned below in the thread)
@phated Looks like you renamed |
@erikkemperman yeah, I reorganized the project. Feel free to rebase if you have time now (otherwise I was going to do it in a branch). I believe |
@erikkemperman I wonder if the 2 failing tests are related to https://www.npmjs.com/package/glob-parent#windows - maybe @es128 would know |
That's not a glob-parent issue, it's a node-glob issue
Yes, that's why I just corrected you |
@jonschlinkert not quite - remember gulpjs/glob-parent#13 |
@erikkemperman @jonschlinkert @doowb I'm trying the glob-parent thing at 6715d6b to see if anything changes on windows (yay appveyor) |
also, fwiw is exactly why I've stated a bunch of times that we should try to do anything at all to work around these backslash issues. I was concerned that it would make it harder for users to figure out where the issue was being caused. But it's making it harder for us to figure it out too. |
I believe I agreed and wanted to tell people to use |
My test didn't work 😛 |
true, good point. I'm not sure what we can do to fix this (other than using a different glob lib) |
I just logged out the paths in different places in windows and the glob pattern that's being passed to
I'm going to see if "doubling up" the escape characters on windows does anything (like @jonschlinkert mentioned above), but this is something that |
Same results when the pattern looks like this: |
I'm fine with ripping out the backslash auto-fix thing with a major version bump if it's causing other problems. But is that what's happening here? |
@es128 I don't think it's a glob-parent problem because I attempted the |
@doowb interesting!!!! What are the results for the other test because that is getting the inverse and might lead us to the solution |
I updated the comments above with the correct amount of |
FWIW I've rebased this branch onto tip of master at https://github.com/erikkemperman/glob-stream/tree/test-edge-cases-rb About the slash/separator ambiguity: remember these tests just reflect my understanding of the syntax emerging from earlier discussion -- so maybe let's take a step back and double check if I am actually testing the desired behaviour? Although they pass on Travis, so there's that :-) |
@erikkemperman I don't know that we've ever talked about parens at the end of a path, I've only ever considered them in the directory position. Edit: And only in relation to |
@erikkemperman please rebase into this branch. I've also split your tests into a separate |
Thinking more about this, we don't even know if |
|
results of one that's passing:
|
Testing things that are the responsibility of your dependencies makes sense to a point so you can easily swap them out in the future. But going deep on contrived edge cases, unless these are cases that have come from real users, may not. |
5fd52e3
to
45f112e
Compare
Removing the 6.0 milestone on this because I think it's going to end up being closed without merging. Let's continue to discuss if anyone has more thoughts on it. |
Rebased but coming back to this thread it might no longer be needed. I'm not even sure these are valid file names on Windows, and if so if git handles them correctly. Does checking out this branch on Windows even yield all 4 files in Anyway, fair enough if I'm actually testing the wrong edges :-) Feel free to just close this, or I guess we could skip if on Windows. |
An aside: Maybe we should be testing these cases as directory segments of a glob instead of the glob itself? |
Well, what I intended to make explicit here is my (mis?)understanding of how parens and/or exclams would be handled at the beginning of a pattern, because the exclam means something in |
So re: your suggestion of edge case in directory segments, I think the significance of beginning in my previous post is that I'd expect these would apply the same way for |
@erikkemperman I understand that I don't know if ending with vs having the |
@phated IIRC the discussion earlier turned to the potential confusion between a pattern to go into the ignore option of And the (slightly idiotic *) possibility of wanting to match literal exclams and parens in actual paths. Hence the combinations. But I may very well have things backwards, yay GMT+1. (*) I've had the misfortune of having to develop for folks who thought such things were perfectly reasonable names for their files. |
totally agree, @es128 said it best |
Sorry for trailing off there, sleeeep. So just to reiterate, I think that these tests do belong here, if anywhere, because they make explicit an API difference with latest I'll leave it up to @phated to close this PR unmerged, or maybe just skip them on Windows, and apologize to everyone for having wasted your time on this! |
@erikkemperman before we test that, you should create the pattern + ignore tests in node-glob to make sure they are working on Windows. If those tests work and ours don't, only then are we transforming |
fwiw I don't feel that way at all. It is what it is. Windows paths have always been difficult to work with, but we have to deal with it and just keep looking for ways to minimize the potential for regressions. I can't speak for anyone else, but I don't know everything there is to know about |
Forgot to mention, I tested the failing patterns directly with node-glob and got the same result that the tests are getting. Both on mac and windows. I'm not sure if you're getting something different with node-glob, but if so I'm at a loss. |
So, I spent some time with And I've tracked down that it is indeed because it treats escape chars (backslash) as path separators: https://github.com/isaacs/minimatch/blob/master/minimatch.js#L123-L125 Several issue reports and proposals to resolve this have been submitted: isaacs/minimatch#64 But these would not appear to be going anywhere, maintainer is probably too busy with other stuff. I don't think there's much we can do here except hoping Windows users won't want to match literal exclams and parens. |
@erikkemperman @jonschlinkert thanks for testing those cases in node-glob. I think I'm going to close this because it's really out of our control and there isn't a good way for us to test that we are grouping things correctly when glob isn't working correctly. |
Fair enough! Too bad Isaac doesn't get around to addressing issues very often, or delegate. Escaping is currently just not possible in minimatch on windows! |
@erikkemperman That's exceptionally frightening! I agree with you and wish he'd add some contributors to the projects. |
(Don't merge, broken on win32).
I thought I might clean up and contribute some of my stumbling around the edges of the node-glob update and corresponding ignore option shuffle.
This is the syntax, at least if I've now understood previous discussion properly, that users would need for several edge cases. Agree?
Unfortunately it is slightly unpractical for me to debug why this breaks on windows, exactly, but I'd guess that somewhere it treats our escape character as path separator. If so, I think that ought to be addressed?
Travis passes,
Appveyor doesn't.