-
-
Notifications
You must be signed in to change notification settings - Fork 231
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: pass correct args to tranformer (#153) #154
Conversation
@CodeTroopers thanks for pointing that out. This complicates things a bit. It seems like the problem is that the expected signature of Did the I think that it would be least confusing if "transformer" meant the same thing everywhere. Either it should always accept an options object or it should always accept a filename. I can update my changes to also update the documentation for It might be annoying to people who have adopted the new "transformer" signature to have to flip-flop back to the old way, and it's kind of a sneaky breaking change, but it still makes the most sense to me, and I think it's the least confusing long-term. What do you think? Updating the documentation of |
Well I always remain perplex on the role and the implementation of this
I'm not sure to understand all the behavior requested by hooking mechanisms but it seems that there is a redundancy effect by offering a hook of |
@CodeTroopers I believe @bcoe provided some explanation for the advantages of hooking
From my perspective, I personally don't know the inner workings of
This concern does not make sense to me. The type and count of arguments for the functions that you are hooking seems like an implementation detail of those functions. I don't see what it has to do with the user-supplied transformation callback. The transform callback has a very simple purpose. It takes the original code and transforms it in some way that the user wants. The way I see it, passing the filepath to the transformation function is just a convenience. If you want to apply different transformation logic for different sets of files, you could achieve that by calling One important thing to consider, however, is that it is potentially nice for different parts of the istanbul API to work well together. In the past,
as opposed to
(see https://github.com/istanbuljs/istanbuljs/blob/master/packages/istanbul-lib-instrument/src/instrumenter.js#L77 for instrumentSync implementation) It is really just a coincidence that |
Ok, thanks for your explanations.
When i hook a function, I want to be able in my |
@kevinkir @CodeTroopers I don't care too much about the changing function signature (going from a string to an object). What concerns me as a maintainer of this library, is that we should have flagged this change as a breaking change, this was the point I was trying to make in #99 we need to take breaking API changes seriously, so that we're bumping major semver versions rather than minor. I think the right thing to do is to land @kevinkir's changes, since we didn't announce the API signature change as a breaking change; and this version of Istanbul has only been out for a few weeks. |
No description provided.