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.
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 by coffee.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.
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. https://github.com/jashkenas/coffeescript/pull/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.