Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Pretty Print when using rules (#440) #480

Merged
merged 4 commits into from Jun 17, 2022

Conversation

dumpsterfireproject
Copy link
Contributor

@dumpsterfireproject dumpsterfireproject commented May 30, 2022

🤔 What's changed?

  • updated internal/models/feature.go to also find scenarios, backgrounds, and steps that occur under rules
  • updated internal/formatters/fmt_pretty.go to also output backgrounds that occur under rules
  • updated feature/formatter/pretty.feature to include some simple examples with rules
  • updated run_test.go to account for new scenarios added in this PR
  • added internal/formatters/formatter-tests/features/rules_with_examples_with_backgrounds.feature and internal/formatters/formatter-tests/pretty/rules_with_examples_with_backgrounds to provide additional testing of this change

⚡️ What's your motivation?

Fixes #440

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

The description in #440 focused on the pretty formatter. I kept the scope for this PR limited to the pretty formatter. I can add tests and look into any issues that come up with rules with the other formatters. My thought was to limit scope for this PR to just the pretty formatter, but if you want a different approach, just let me know. If there are additional tests that are needed, please let me know that as well.

📋 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.

@codecov
Copy link

codecov bot commented May 30, 2022

Codecov Report

Merging #480 (c639f6a) into main (c5a86a4) will increase coverage by 0.29%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #480      +/-   ##
==========================================
+ Coverage   81.42%   81.72%   +0.29%     
==========================================
  Files          27       27              
  Lines        2197     2232      +35     
==========================================
+ Hits         1789     1824      +35     
  Misses        312      312              
  Partials       96       96              
Impacted Files Coverage Δ
internal/formatters/fmt_pretty.go 81.39% <100.00%> (+0.82%) ⬆️
internal/models/feature.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5a86a4...c639f6a. Read the comment docs.

@mattwynne
Copy link
Member

This looks great, thanks! There are some nit-picks with the indentation in the feature file but otherwise I'm sold on it.

Are you pretty confident it should work if there's a scenario outline instead of a scenario inside the rule? I can't tell from reading the code whether that's a risk or not.

I'm all in favour of small incremental PRs. I guess to fully implement Rules we will still want to...

  • test the other formatters with Rule in the features to check they don't crash
  • support outputting rules in the pretty formatter

@mattwynne mattwynne requested a review from vearutop June 9, 2022 19:01
@mattwynne mattwynne mentioned this pull request Jun 9, 2022
@dumpsterfireproject
Copy link
Contributor Author

I added a test for a rule with a scenario outline as well.

@mattwynne
Copy link
Member

Looks good to me! Any feedback @vearutop?

@mattwynne mattwynne merged commit 5d705e5 into cucumber:main Jun 17, 2022
@aslakhellesoy
Copy link
Collaborator

Hi @dumpsterfireproject,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

@mattwynne
Copy link
Member

Welcome to the team @dumpsterfireproject!

You're now able to push directly to branches within the https://github.com/cucumber/godog repo, so no need to use your own fork now unless you particularly want to.

This also means you have the permissions to review and merge other people's pull requests. If you have any time or inclination for that, it would be greatly appreciated!

@mattwynne
Copy link
Member

Oops, we forgot to update the CHANGELOG.md - can you do that, @dumpsterfireproject? You could make a commit direct to main for something like that, rather than making another PR.

@dumpsterfireproject
Copy link
Contributor Author

Sure, I'll get the CHANGELOG.md updated. Thanks.

dumpsterfireproject added a commit that referenced this pull request Jun 18, 2022
Add bug fix from PR #480 to CHANGELOG.md.
@dumpsterfireproject dumpsterfireproject mentioned this pull request Jun 18, 2022
7 tasks
dumpsterfireproject added a commit that referenced this pull request Jun 18, 2022
Add bug fix from PR #480 to CHANGELOG.md.
@longyue0521 longyue0521 linked an issue Jun 10, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crash when run rule example in gherkin reference Rule is not supported
3 participants