Skip to content

Conversation

@y-hsgw
Copy link
Member

@y-hsgw y-hsgw commented Oct 23, 2025

Checks

Changes

  • This PR fixes an issue in the prefer-by-findby rule where the autofix incorrectly produced code missing the expect wrapper when an assertion was involved.

Target:

await waitFor(() =>
    expect(
      screen.getByRole('button', { name: 'Count is: 0' }),
    ).toBeInTheDocument(),
  )

Before (incorrect autofix output):

await screen.findByRole('button', { name: 'Count is: 0' })

Expected (correct output):

expect(
  await screen.findByRole('button', { name: 'Count is: 0' }),
).toBeInTheDocument()

Context

Fixes: #579

@Belco90 Belco90 merged commit 09a9f8c into main Oct 28, 2025
32 checks passed
@Belco90 Belco90 deleted the fix/prefer-find-by branch October 28, 2025 09:11
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.

prefer-find-by autofix doesn't respect extra code

3 participants