noPlaywrightMissingAwait
Ta treść nie jest jeszcze dostępna w Twoim języku.
Summary
Section titled “Summary”- Rule available since:
v2.4.2 - Diagnostic Category:
lint/nursery/noPlaywrightMissingAwait - This rule has an unsafe fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noPlaywrightMissingAwait": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”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();});Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.