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

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

1 participant