Skip to content

Feature request: Rule for .toPass function to ensure that it defines a timeout on it. #345

@gustavo-meilus

Description

@gustavo-meilus

When retrying an action or a series of actions, I often use expect(async () => ...).toPass(). However, it would be useful to have a rule that warns or shows an error if .toPass() is used without explicitly defining a timeout. The Playwright documentation notes that:

By default, .toPass() has a timeout of 0 and does not respect the custom [expect timeout](https://playwright.dev/docs/test-timeouts#expect-timeout).

This behavior can lead to unwanted delays, as the default timeout of 0 may cause tests to wait until the test's overall timeout, rather than failing early as expected.

Playwright Documentation:

.toPass() Assertion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions