Skip to content
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

Coffeescript utility classes now will have logical branches ignored in coverage #36

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

samuelhorwitz
Copy link

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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant