Skip to content

fix(jest): preserve custom environment handleTestEvent#1461

Merged
epszaw merged 1 commit into
mainfrom
fix-jest-cust
May 4, 2026
Merged

fix(jest): preserve custom environment handleTestEvent#1461
epszaw merged 1 commit into
mainfrom
fix-jest-cust

Conversation

@formaceft-93
Copy link
Copy Markdown
Contributor

@formaceft-93 formaceft-93 commented May 1, 2026

This fixes createJestEnvironment overwriting handleTestEvent from custom Jest environments. That broke integrations such as jest-environment-puppeteer, where users rely on handleTestEvent to react to Circus events, for example taking screenshots on test_fn_failure.

The factory now captures any existing environment event handler, calls it first, and then runs Allure’s own event handling. Sync handlers, async handlers, and thrown/rejected errors are all preserved: Allure still processes the event, and Jest still receives the original failure.

Closes #1289

Checklist

@formaceft-93 formaceft-93 requested a review from epszaw May 1, 2026 11:09
@formaceft-93 formaceft-93 added the type:bug Something isn't working label May 1, 2026
@github-actions github-actions Bot added the theme:jest Jest related issue label May 1, 2026
@epszaw epszaw merged commit 4c68568 into main May 4, 2026
75 of 76 checks passed
@epszaw epszaw deleted the fix-jest-cust branch May 4, 2026 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:jest Jest related issue type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

createJestEnvironment doesn't support #handleTestEvent

2 participants