Skip to content

Send @cucumber/messages.HookType to formatters on the "hook" event #2462

@tristanzander

Description

@tristanzander

🤔 What's the problem you're trying to solve?

Currently, to determine whether a hook is a Before/After hook, we use code that looks similar to the following:

let isAfterHook = false;

for (const step of testCase) {
   isAfterHook = isAfterHook || step.stepDefinitionId != null;

   // Do more reporting
}

While this works, it doesn't have the ability to accurately format BeforeAll/BeforeStep/AfterAll/AfterStep hooks. Some of the reports we generate can be a bit misleading as a result.

✨ What's your proposed solution?

Ideally, Cucumber would pass the type parameter on @cucumber/messages.Hook to the formatter so that we can determine the exact type of hook that was run.

⛏ Have you considered any alternatives or workarounds?

No response

📚 Any additional context?

I believe this parameter was added after @cucumber/messages@v24, which is probably why it isn't already being sent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions