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

[Core] Indent stacktrace in pretty formatter #2970

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Jan 31, 2025

🤔 What's changed?

Renders the stack trace in the pretty formatter with the same indent as the step that failed it.

Before

[INFO] Running io.cucumber.skeleton.RunCucumberTest

Scenario: a few cukes               # io/cucumber/skeleton/belly.feature:3
  Given I have 42 cukes in my belly # io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(int)
    org.opentest4j.AssertionFailedError:
expected: "b"
 but was: "a"
  at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
  at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
  at io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(StepDefinitions.java:12)
  at ✽.I have 42 cukes in my belly(classpath:io/cucumber/skeleton/belly.feature:4)

After

[INFO] Running io.cucumber.skeleton.RunCucumberTest

Scenario: a few cukes               # io/cucumber/skeleton/belly.feature:3
  Given I have 42 cukes in my belly # io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(int)
      org.opentest4j.AssertionFailedError:
      expected: "b"
       but was: "a"
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
        at io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(StepDefinitions.java:12)
        at ✽.I have 42 cukes in my belly(classpath:io/cucumber/skeleton/belly.feature:4)

🏷️ What kind of change is this?

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

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

@mpkorstanje mpkorstanje changed the title [Core] Indent pretty formatter stacktrace [Core] Indent stacktrace in pretty formatter Jan 31, 2025
@mpkorstanje mpkorstanje force-pushed the pretty-formatter-indent-stacktrace branch 4 times, most recently from ab20f66 to 86a3e95 Compare February 2, 2025 14:07
Renders the stack trace in the pretty formatter with the same indent as
the step that failed it.

Before

```
[INFO] Running io.cucumber.skeleton.RunCucumberTest

Scenario: a few cukes               # io/cucumber/skeleton/belly.feature:3
  Given I have 42 cukes in my belly # io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(int)
    org.opentest4j.AssertionFailedError:
expected: "b"
 but was: "a"
  at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
  at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
  at io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(StepDefinitions.java:12)
  at ✽.I have 42 cukes in my belly(classpath:io/cucumber/skeleton/belly.feature:4)
```

After

```
[INFO] Running io.cucumber.skeleton.RunCucumberTest

Scenario: a few cukes               # io/cucumber/skeleton/belly.feature:3
  Given I have 42 cukes in my belly # io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(int)
      org.opentest4j.AssertionFailedError:
      expected: "b"
       but was: "a"
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
        at io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(StepDefinitions.java:12)
        at ✽.I have 42 cukes in my belly(classpath:io/cucumber/skeleton/belly.feature:4)
```
@mpkorstanje mpkorstanje force-pushed the pretty-formatter-indent-stacktrace branch from 86a3e95 to 563c379 Compare February 2, 2025 14:36
@mpkorstanje mpkorstanje merged commit 410d5f5 into main Feb 2, 2025
6 checks passed
@mpkorstanje mpkorstanje deleted the pretty-formatter-indent-stacktrace branch February 2, 2025 14:39
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.

1 participant