Skip to content

fix: beforeEach/afterEach leaking into sibling describe blocks with same nested name - #1850

Open
one-git-wonder wants to merge 1 commit into
pestphp:5.xfrom
one-git-wonder:fix/heirarchical-test-naming
Open

fix: beforeEach/afterEach leaking into sibling describe blocks with same nested name#1850
one-git-wonder wants to merge 1 commit into
pestphp:5.xfrom
one-git-wonder:fix/heirarchical-test-naming

Conversation

@one-git-wonder

Copy link
Copy Markdown

What:

  • Bug Fix

Description:

beforeEach/afterEach hooks registered inside a nested describe block leaked into tests in a sibling describe block that shared the same inner describe name, producing misleading ErrorException: Undefined property errors.

Replace the loose membership check with a strict prefix check. A hook now fires only if its entire describe path is a prefix of the test's describe path, which correctly scopes hooks to their own hierarchy while still allowing outer describe hooks to cascade into nested describes.

Related:

#1522

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