Coffeescript utility classes now will have logical branches ignored in coverage #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First of all, I just want to acknowledge how utterly terrible this solution is. I'm opening this pull request partially as a starting point to discussion.
Currently, there are logical branches in some of the Coffeescript utility functions. This leads to coverage reporting that claims incomplete coverage despite the Coffeescript being fully covered and only the backing Javascript being technically incomplete in coverage.
Coffeescript gives no way of not including the boilerplate functions, despite large discussions of the topic. jashkenas/coffeescript#1820
There also seems to be no easy way to hook into the compiler to override the functions.
So it appears a find and replace of the function bodies is the best bet, barring updates to the Coffeescript compiler which both are unlikely and not compatible with people compiling to older versions of Coffeescript (if for some reason they are doing this). I have attempted to come up with a solution that, while ugly, is at least somewhat thought out for what it is.
One thing I can't vouch for: does it matter that I mess with the
code.js
that is returned bycoffee.compile
directly? How does this affect the sourcemaps that Coffeescript generates? I didn't look to closely into this as it didn't appear to have any effect.Anyway, maybe someone knows a better trick or can think of a better way of doing this, but so far this my solution.