dylanb / gulp-coverage

Gulp coverage reporting for Node.js that is independent of the test runner
MIT License
60 stars 12 forks source link

random __instrumented_miss property added in objects #16

Closed OmarCastro closed 10 years ago

OmarCastro commented 10 years ago

When im testing my project, sometimes they fail because an "__instrumented_miss" property is added inside objects

OmarCastro commented 10 years ago

i found that commenting the "__instrumented_miss"'s fixes this problem, is it expected that commenting it breaks something?

dylanb commented 10 years ago

Which line did you comment? The instrumented miss property is added to track code execution. So commenting it out will make it look like your code coverage is better than it actually is. If you can share the code that is failing, perhaps I can fix the real source of the problem.

OmarCastro commented 10 years ago

Well, I am using mocha with should.js, and to check for object equality, i use

object1.should.be.eql(object2) 

i sent a pull request showing the lines i have commented

dylanb commented 10 years ago

There are a couple of ways to deal with this:

1) sanitize the object by removing the __instrumented_miss attributes before comparing, this will have the downside of subsequently not tracking chainables properly, or 2) do your compares on specific attributes that are part of the objects rather than the whole object, or 3) Write your own deepEqual that ignores these attributes

dylanb commented 10 years ago

ok, I have a way to fix your problem without affecting the functionality. Stay tuned.

dylanb commented 10 years ago

OK, looks like I fixed it in this commit https://github.com/dylanb/gulp-coverage/commit/161b692b3a569ace131fd74e6caf00cc20a06e8d

Please try version 0.1.21 and confirm that it is fixed.

dylanb commented 10 years ago

@OmarCastro I am going to close this issue soon, please confirm the fix.

OmarCastro commented 10 years ago

Sorry for the late reply,

Well, i tested it, but I cant confirm it, because i advanced so much in the project, that it became difficult to use the gulp-coverage, it now shows an error that a module imported with a require is missing some properties, tough I dont mind closing it, and reopening it later.

dylanb commented 10 years ago

Is the error related to gulp-coverage?

OmarCastro commented 10 years ago

all tests passes with mocha, so it is very possible that it is related to gulp-coverage.

dylanb commented 10 years ago

can you post the error and the code?

dylanb commented 10 years ago

@OmarCastro - closing, please open another issue if you have more data on this issue