This adds a pretty formatter to cucumber-js. It makes some changes to the Core API to enable traversing from the feature object down to the steps with their step results. Tests for this are in another commit that will be part of another pull request.
Add pretty formatter.
Thank you Renier.
I'd like to keep the AST (abstract syntax tree) decoupled from the execution, the results and therefore keep it stateless. What I mean by that is the execution results are not supposed to be stored on AST objects. In other terms, a tree should be able to be visited (executed) more than once.
Practically, Cucumber.Ast.Step should know nothing about StepResult objects.
Let's do some BDD here ... :)
Outcome: The formatter should be able to display the step name/contents related to a step result, when it receives one.
Context: Step results currently have no link to their parent step.
I think that the AST objects remembering the last result for that object, if there was any, does not prevent the tree from being executed/visited more than once.
However, I see nothing wrong with your proposal of instead feeding the AST object into the step result. I'll have to look at the code again with that idea in mind and see if there are any problems. If not, it should not be hard to refactor.
I'm almost done implementing the second solution. 6b58ca2
I'll finish that today I think.
Store step on step results (#57)
- The parent step is now available on all types of step results
- Step results "inherit" from a base step result object (extraction refactoring)
@renier you can now call stepResult.getStep() on any kind of step result.