Skip to content

fix: avoid panic when post hook panic#699

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

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

Conversation

@chengxilo
Copy link
Copy Markdown
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
Copy Markdown

codecov bot commented Jul 23, 2025

Codecov Report

❌ Patch coverage is 75.86207% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.17%. Comparing base (153db4e) to head (8cd61c3).
⚠️ Report is 61 commits behind head on main.

Files with missing lines Patch % Lines
suite.go 75.86% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #699      +/-   ##
==========================================
- Coverage   83.21%   78.17%   -5.04%     
==========================================
  Files          28       41      +13     
  Lines        3413     3349      -64     
==========================================
- Hits         2840     2618     -222     
- Misses        458      606     +148     
- 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

post handlers not protected by defer/recover

1 participant