Closed queicherius closed 7 years ago
@queicherius Thanks for reporting the issue and sorry for the delay.
Generally speaking I am no fan of adapting the source code to work with a particular test/mocking/instrumentation framework.
In your particular case I would prefer to use es6 multiline strings instead of providing a function which is stringified later on.
In your particular case helper getters should only be injected if a reference to a module level import, function or constant exist. In this case I think your code might be missleading anyway (a reference to a variable which is not available in the database's context).
If a variable is rewired which is not a reference to a module scoped variable, than I think it is an error on this plugins side which must be fixed.
Could you please let me know if this is your case. If it is an issue could you please provide a short sample code, which can reproduce the error you mentioned.
I ended up using the es6 multiple strings and forgot to close this issue. Thanks! 👍
It would be nice if this plugin offered a way to disable the instrumentation on a function level, e.g. like istanbul does it using
/* istanbul ignore next */
(see here).The use case I have for this right now is some code, that used inside MongoDB for map/reducing and it can not find the
__get__
function there for obvious reasons. The issue is described here as well, however it works with istanbul now (with the comment describe above).