src/content/docs/linter/rules/no-playwright-missing-await.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> :::caution This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time. ::: ## Summary - Rule available since: `v2.4.2` - Diagnostic Category: [`lint/nursery/noPlaywrightMissingAwait`](/reference/diagnostics#diagnostic-category) - This rule has an [**unsafe**](/linter/#unsafe-fixes) fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - This rule belongs to the following domains: - [`playwright`](/linter/domains#playwright) - Sources: - Same as [`playwright/missing-playwright-await`](https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/missing-playwright-await.md){
"linter": {
"rules": {
"nursery": {
"noPlaywrightMissingAwait": "error"
}
}
}
}
Enforce Playwright async APIs to be awaited or returned.
Playwright has asynchronous matchers and methods that must be properly awaited. This rule identifies common mistakes where async Playwright APIs are not properly handled, which can lead to false positives in tests.
test('example', async ({ page }) => {
expect(page.getByRole('button')).toBeVisible();
});
test('example', async ({ page }) => {
test.step('step', async () => {});
});
test('example', async ({ page }) => {
await expect(page.getByRole('button')).toBeVisible();
});
test('example', async ({ page }) => {
await test.step('step', async () => {});
});
test('example', async ({ page }) => {
return expect(page.getByRole('button')).toBeVisible();
});