Just use vanilla functions and objects, and when in need of something that looks like a class, reach for the revealing module pattern:
https://gist.github.com/zcaceres/bb0eec99c02dda6aac0e041d0d4...
Just use vanilla functions and objects, and when in need of something that looks like a class, reach for the revealing module pattern:
https://gist.github.com/zcaceres/bb0eec99c02dda6aac0e041d0d4...
It also makes specialization and calling super methods super verbose.
And you've ultimately not done anything other than reimplementing OOP, poorly.
OOP inheritance does not belong in this pattern, even if you could hamfist it in (which you've already observed as unwieldy).
Is there a better way?
But even conceptually there are problems with testing private methods. For example they likely expect to be called only while the class is in some specific state or in the middle of some atomic operation. Otherwise they could have just been made public.
Maybe I don't write very complicated material, but I can't think of a single time I've needed to use the more OOP features of JS because one of them was the best or only solution.