Skip to content

[🐛 Bug]: Hook executed : console noise from spec reporter w/ cucumber and realtimeReporter #9589

@zachlysobey

Description

@zachlysobey

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

7.16

Node.js Version

18

Mode

WDIO Testrunner

Which capabilities are you using?

{
  // ...
  reporters: [
    ['spec', { realtimeReporting: true
  ]
}

What happened?

With cucumber hooks (Before(...), etc...) the spec-reporter with realtimeReporting enabled spits logs that look like Hook executed : with no additional context. For folks who have a bunch of hooks like myself, it ends up creating a lot of low-value noise.

The log comes from the following line, as introduced in #7572

https://github.com/webdriverio/webdriverio/blob/main/packages/wdio-spec-reporter/src/index.ts#L151

What is your expected behavior?

I see two approaches to better behavior:

  1. Empower adding of a Hook.title to cucumber hooks

    Experimentally, I tried a number of approaches to this, but no solution presented itself. Apologies if I missed something.

  2. avoid logging at all if a title isn't present

The 2nd option is something I'd personally be willing to implement and PR. For 1), I couldn't easily trace the code to that point, so I'm not immediately clear on how to tackle it.

How to reproduce the bug.

With a cucumber project, set a Before hook, and use the spec reporter as described above. Run the tests.

Relevant log output

Hook executed :
Hook executed :
Hook executed :
Hook executed :
Hook executed :
Hook executed :
...

Code of Conduct

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

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛good 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