-
-
Notifications
You must be signed in to change notification settings - Fork 470
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
Unc path #192
Unc path #192
Conversation
9c0876b
to
253be9a
Compare
further context: isaacs/node-glob#192
@staticshock & @isaacs I believe this is ready for review. I'll gladly make changes, so keep me posted. |
|
* pre-packager will require an explicit dep-graph.json * we no longer need module information for the module transpiler * glob is basically broken in windows on shares – pending: isaacs/node-glob#192
This is pretty close! I inadvertently optimized away your minimatch change, but then I fixed it on 2.0.7. I am still running into a bit of a weird issue with the test, because the I think the right approach here, though it's more lines changed, is to pass the platform as an option to Glob, and then load all the appropriate separator/absolute/etc stuff onto the glob object, so it never has to look at I'm thinking something like this in the self.platform = opts.platform || process.platform
self.isAbsolute = isAbsolute[self.platform] || isAbsolute;
self.resolve = path[self.platform].resolve || path.resolve;
self.sep = path[self.platform].sep || path.sep; And then, throughout This also means that, if at some point we need to change just one of these fields, or use AOP to debug those function calls, we can either make those fields configurable, or instantiate an object and just change the relevant bits. Of course, this can lead to glob doing something weird in some cases, but it'd make it so that we can test other windows irregularities in the future more easily, with a lot less module cache tinkering. What do you think? |
I'm on-board with passing platform in. In-fact it was something I considered but opting out of merely to avoid a more controversial PR. So if you are +1, I'll make it so. Just a heads-up I'll likely have time again tomorrow to work on this. That being said, with more drastic changes I will likely want to get all the windows tests working. So the changes will likely be a-bit more involved. Is that ok? |
I'm totally ok with involved changes that improve testability, windows support, and make the code easier to follow (including fewer hacky workarounds in tests). Of course, bigger PR size tends to make for more back and forth in the review process, but I think we're pretty aligned on what needs to happen for this. |
Ya I'm fine with thorough back + forth, as this module had |
33cc844
to
cadc406
Compare
@isaacs sorry for the delay, been under the weather. Anyways, this is ready for another review. One question (and the last failing test), is path in node
|
UGGHHHH that's right. I'd say just skip that test in node <= 0.10. The code should still work fine, and since this is really just a matter of string juggling stuff, it should be fine to run the tests in only later versions. |
@isaacs whats the ideal way to detect node 10? Something like https://www.npmjs.com/package/nversion ? Or a funky regexp |
I'd throw something like this in there: var skip = false
if (/^v0\.(10|[0-9])\./.test(process.version)) {
skip = 'Does not work on Node < 0.12'
}
test('some test name', { skip: skip }, function (t) { ... |
If you wanna just leave the tests failing in 0.10, that's fine, too. I can work it out when I merge it in. If it's passing in 0.12 and io.js, then I can take it from there :) |
Ok, just reviewed. The test looks perfect, and nothing in the code jumps out at me as problematic. If you think this is ready to go, I can merge and release this weekend or early next week. |
I'll add the
👍
My use-cases work correct, I tried several ways to break it and couldn't find anything. I am fairly confident. But full disclosure, my windows-foo is weak. Also, I will be on vacation new week. So if you release I wont be able to deal with fall-out, it will be on you. If you wait a week, I can help out with any fall out. Your call sir. |
…m specific path hooks path.posix / path.win32 context: isaacs#192 (comment)
sorry, i am unclear why the skip isn't working as expected :( |
lets actually hold off, I may have noticed other scenarios... such pandora's box. |
Wildcards that now work: \\host\directory\* Wildcards that still don't work: \\host\* [fixes isaacs#74, isaacs#123, isaacs#146] handle UNC paths on win32 credit to @staticshock for the WinPath work
…m specific path hooks path.posix / path.win32 context: isaacs#192 (comment)
0619e02
to
5339006
Compare
rebased, going to fire up the old windows gaming rig after breakfast and see whats next. |
Tests should now correctly run, even on old versions of node. Switching to windows now, lets see whats left on this side of things. |
@isaacs i have added the appveyor configuration, is it possible for you to set up the appveyor.com side of things? I would doit, but then node-glob would end-up stefanpenner/node-glob on appveyor. It should be as simple as singing up for the free tier, and adding this repository. As for making the tests pass on windows, I have put together a short triage list, and will work on them this afternoon. If I run into any blockers, I will report back. |
It looks like the issue is that the WinPath stuff in the The mocking and testing stuff looks pretty good. I think it's the right approach. On master right now, all the tests pass on Windows. I'd recommend rebasing, and then applying the changes one by one and making sure that tests pass at each commit. |
further context: isaacs/node-glob#192
No longer an issue in v9. |
This is a hybrid of @staticshock and my work.
WinPath
implementationmock-fs
and somepath.sep
andpath.resolve
faking, simulate the windows environemnt.future work: