cucumber-js: this in beforestep hooks is not world
this in beforestep hooks is not world. (It is undefined)
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 22 (10 by maintainers)
this in beforestep hooks is not world. (It is undefined)
@benjamine cucumber-js already keeps track of how long each step takes. That data is available in the json formatter and in the new usage formatters
@jbpros BeforeStep and StepResult events are useful. In my case I’m using them to log timings for each step (only when there’s a failure or in a verbose mode), which sometimes helps sometimes debugging, or find slow steps. I can see it also being useful to run certain checks after a step that has a tag, eg:
Then you can use that tag to take a screenshot after that step and use it for screenshot comparison checks, just an example.
ps: my bad, tags cannot be applied to a specific step, https://github.com/cucumber/cucumber/wiki/Hooks#tagged-hooks