-
Notifications
You must be signed in to change notification settings - Fork 31
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
[Bug] The injected codes make the Promise(bluebird) can not work. #56
Comments
I think I know what's going on here. As a workaround, if you change:
to
I bet it will work. I suspect what's going on here is we're instrumenting the empty function, adding a |
why should inject the code to empty function and return a value?
|
Yeah, it's a bug for sure. The way coffee-coverage works is to instrument the original coffee-script before compilation, so we change:
to something like:
At the end of the test, we know how many times the 0th function and 1st statement were run. But, of course, this is wrong; it should be generating:
|
It will solve the first problem in above list if so. But It still make the checker(isEmptyFunction) error. The test whether empty function(second problem in the list) is important for my case too, My createObject function in the inherits-ex depends on it. this make it easier to write a class. inherits = require 'inherits-ex'
createObject = require 'inherits-ex/lib/createObject'
class A
constructor: ->console.log 'A'
class B
inherits B, A
b = new B # the original way
b = createObject B # the constructor of A will be executed because the B's constructor is empty. I have to work around the coverage's bug in my isEmptyFunction function temporarily. |
Hmm, interesting corner case. You can make a truly empty function with something like:
(We could add a |
class B
inherits B, A The empty constructor is generated by coffee-script compiler. So unless modify the compiler... |
maybe add a switcher to enable the measuring the calls of empty function. |
reproduce:
the result should be:
But after injected:
The text was updated successfully, but these errors were encountered: