Skip to content

fix: avoid panic when post hook panic#699

Open
chengxilo wants to merge 4 commits intocucumber:mainfrom
chengxilo:solve-662
Open

fix: avoid panic when post hook panic#699
chengxilo wants to merge 4 commits intocucumber:mainfrom
chengxilo:solve-662

Conversation

@chengxilo
Copy link
Contributor

@chengxilo chengxilo commented Jul 23, 2025

🤔 What's changed?

add defer/recover logic in runAfterStepHooks and runAfterScenarioHooks, so the panic happens in post hook would be handled gracefully( just like the pre hook)

⚡️ What's your motivation?

Fix #662 .

🏷️ What kind of change is this?

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

♻️ Anything particular you want feedback on?

While I haven't updated the post-hook to output the infomation of panics in the same format as the pre-hook, this change already ensures that the program doesn't stop entirely if a panic occurs in a post-hook. Is that fine?

📋 Checklist:


This text was originally generated from a template, then edited by hand. You can modify the template here.

@codecov
Copy link

codecov bot commented Jul 23, 2025

Codecov Report

Attention: Patch coverage is 70.96774% with 9 lines in your changes missing coverage. Please review.

Project coverage is 77.65%. Comparing base (153db4e) to head (4585c9f).
Report is 38 commits behind head on main.

Files with missing lines Patch % Lines
suite.go 70.96% 7 Missing and 2 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## main #699 +/- ## ========================================== - Coverage 83.21% 77.65% -5.56%  ========================================== Files 28 41 +13 Lines 3413 4149 +736 ========================================== + Hits 2840 3222 +382  - Misses 458 802 +344  - Partials 115 125 +10 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@chengxilo chengxilo marked this pull request as ready for review July 24, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant