-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
proposal: Hide Test
internals. Expose a delegate object instead.
#252
Comments
👍 from me. @vdemedes ? |
What if we just made them non-enumerable? So that we won't need to use |
We would not need to do that. We would create a different object, and put methods on it that were bound to the test instance test: Test.prototype._createPublicAPI = function () {
var api = {};
var self = this;
listOfPublicMethods.forEach(function (methodName) {
api[methodName] = self[methodName].bind(self);
});
}; Or we could use The problem with non-enumerable is that they can still be clobbered. I am working on #25 (registering custom assertion methods) - and we don't want to have to force them to avoid our internals as they name their method. |
Oh, I get it now. |
Hide test internals. Fixes #252.
We expose instances of
Test
to the user. It's thet
in the following code:That has all kinds of internal information on it, including
assertCount
planCount
duration
_timeStart
planStack
We are already looping over all the public methods and binding them to the test here so users can pass around methods without worrying about
this
bindings.I suggest we copy those values (perhaps being a bit more careful to select only that which we truly want public), to a secondary object that we expose.
The text was updated successfully, but these errors were encountered: