Skip to content

[💡 Feature]: Log messages from named Cucumber hooks to the WDIO reporter #8324

@hammzj

Description

@hammzj

Is your feature request related to a problem?

An addition to name Before and After hooks has been added in Cucumber v8.1.0.

Currently, these only are sent to Cucumber's formatter, which I've discussed as as not being used in WebDriverIO in issue #7692. Therefore, we will not see these messages in any WebDriverIO reporter output.

Describe the solution you'd like.

When a Cucumber Before/After hook has the name parameter provided, the WebDriverIO reporters should log the string of that parameter prior to the Cucumber hook being executed.

Describe alternatives you've considered.

I could just log the message within the function of the hook, changing it from

//Hook with name
Before({name: 'General setup'}, function(){
  //...do some setup
});

to

//Hook with log
Before(function(){
  logger.info('General setup');
  //...do some setup
});

However, this is a little less clean when there is a lot going on in the function. Having the name parameter is much cleaner to read and is now the standard way of handling it in Cucumber v8.1.0.

Additional context

Cucumber 8.0 release notes

Named hooks reference

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Idea 💡A new feature ideagood first picka reasonable task to start getting familiar with the code basehelp wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions