Pular para o conteúdo

noPlaywrightMissingAwait

Este conteúdo não está disponível em sua língua ainda.

biome.json
{
"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();
});
code-block.js:2:5 lint/nursery/noPlaywrightMissingAwait  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Async matcher toBeVisible must be awaited or returned.

1 │ test(‘example’, async ({ page }) => {
> 2 │ expect(page.getByRole(‘button’)).toBeVisible();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 │ });
4 │

Async matchers return a Promise that must be handled.

Add await before the expression or return it from the function.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Unsafe fix: Add await before the call.

2 │ ····await·expect(page.getByRole(‘button’)).toBeVisible();
++++++
test('example', async ({ page }) => {
test.step('step', async () => {});
});
code-block.js:2:5 lint/nursery/noPlaywrightMissingAwait  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

test.step must be awaited or returned.

1 │ test(‘example’, async ({ page }) => {
> 2 │ test.step(‘step’, async () => {});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 │ });
4 │

Test steps are asynchronous.

Add await before the expression or return it from the function.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Unsafe fix: Add await before the call.

2 │ ····await·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();
});