Open dewwwald opened 5 years ago
For anyone looking for this feature, a temporary fix would be to do the following:
Once merged I will post here that that package will be removed and add a depreciation warning to that package.
Published on npm under @bigteam/mocha-classes
The gist of the issue
The problem can be reproduced by having a class with a function that calls another member function or tries to access a member variable on the class:
I am curious to know if this was intended or if there is a potential fix here. I am looking in to it, and will keep this thread updated, but I would like your input on this and confirmation on whether this is something you will be willing to fix or merge a PR for?
Further insights
I realize that at first glance this might not seem like something worth solving. My argument for fixing this instead of using a global variable is because the behaviour of class member functions are being modified. I am using a DI framework to inject dependencies into the class. Granted I could just store these injected dependencies on the global scope, but that just feels strange.
Another reason would be the use of helper functions on the member level that themselves will have access to the scope of the class. This seem to me to make sense.