Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 924 Bytes

missing-playwright-await.md

File metadata and controls

42 lines (31 loc) · 924 Bytes

Enforce Playwright APIs to be awaited (missing-playwright-await)

Identify false positives when async Playwright APIs are not properly awaited.

Rule Details

Example of incorrect code for this rule:

expect(page).toMatchText('text')
expect.poll(() => foo).toBe(true)

test.step('clicks the button', async () => {
  await page.click('button')
})

Example of correct code for this rule:

await expect(page).toMatchText('text')
await expect.poll(() => foo).toBe(true)

await test.step('clicks the button', async () => {
  await page.click('button')
})

Options

The rule accepts a non-required option which can be used to specify custom matchers which this rule should also warn about. This is useful when creating your own async expect matchers.

{
  "playwright/missing-playwright-await": [
    "error",
    { "customMatchers": ["toBeCustomThing"] }
  ]
}