-
Notifications
You must be signed in to change notification settings - Fork 8
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
Test visitor decorators #4
Conversation
this.baseVisitTestSuite = baseVisitor.visitTestSuite.bind(baseVisitor); | ||
|
||
this.baseVisitor.visitTest = this.visitTest.bind(this); | ||
this.baseVisitor.visitTestSuite = this.visitTestSuite.bind(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hack is very ugly. This is currently necessary because of the recursive nature of the visitor. When the bottommost visitor in the decorator hierarchy does its recursive call and passes this
to the accept
method, we lose the decorators.
I believe to move the iterating-over-children logic from the visitor to the composite might - perhaps - fix the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so moving back the iteration inside the tree creates more problems (aka handling before/after methods execution, filtering the nodes, etc.). The hack doesn't seem that ugly after all. Will continue thinking about this.
The current test runner is not extensible. For example, the test reporting is embedded in the test runner class. Implementing the Visual Studio Code adapter involved a full re-implementation of the test runner.
I believe using a decorator pattern would allow extending the test runner (and eventually other test visitors) more easily.
Solves #3