Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add hook type #224

Closed
wants to merge 1 commit into from
Closed

Add hook type #224

wants to merge 1 commit into from

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented May 24, 2024

⚡️ What's your motivation?

Hooks in Cucumber can either execute before/after a scenario or before/after a step. Depending on which implementation is used these are put into the json report as either all part of the element.steps field[1] or the element.before and element.steps fields[2][3].

So to create a json reports from messages the type of hook must be included in the message.

  1. https://github.com/cucumber/cucumber-json-converter/blob/main/testdata/cucumber-js/7.3.2/json/failing-before-hook.json
  2. https://github.com/cucumber/cucumber-json-converter/blob/main/testdata/cucumber-jvm/7.2.3/json/failing-before-hook.json
  3. https://github.com/cucumber/cucumber-json-converter/blob/main/testdata/cucumber-jvm/7.2.3/json/failing-after-step-hook.json

Fixes: #72

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

Feel free.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

Hooks in Cucumber can either execute before/after a scenario or
before/after a step. Depending on which implementation is used these are
put into the json report as either all part of the `element.steps`
field[1] or the `element.before` and `element.steps` fields[2][3].

So to create a json reports from messages the type of hook must be
included in the message.

 1. https://github.com/cucumber/cucumber-json-converter/blob/main/testdata/cucumber-js/7.3.2/json/failing-before-hook.json
 2. https://github.com/cucumber/cucumber-json-converter/blob/main/testdata/cucumber-jvm/7.2.3/json/failing-before-hook.json
 3. https://github.com/cucumber/cucumber-json-converter/blob/main/testdata/cucumber-jvm/7.2.3/json/failing-after-step-hook.json
@luke-hill
Copy link
Contributor

As/when you get this in a spot to be merged let me know as I'll start getting my stuff ready too as then it'll be a decent time for a chunky major release (My stuff is breaking but small).

@mpkorstanje
Copy link
Contributor Author

It will be a while. I'm doing this for the JSON formatter, but that thing is overly complicated. And I'm getting side tracked with other projects in the same vein that are easier.

@luke-hill
Copy link
Contributor

@mpkorstanje is this now redundant by #102 ?

@luke-hill luke-hill deleted the add-hook-type branch January 29, 2025 18:34
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ndjson message - Add hook type to message
2 participants