跳转到内容

noPlaywrightForceOption

此内容尚不支持你的语言。

biome.json
{
"linter": {
"rules": {
"nursery": {
"noPlaywrightForceOption": "error"
}
}
}
}

Disallow usage of the { force: true } option.

Playwright’s force option bypasses actionability checks and can lead to unreliable tests. Instead of using { force: true }, you should fix the underlying issue that requires forcing the action.

await page.locator('button').click({ force: true });
code-block.js:1:7 lint/nursery/noPlaywrightForceOption ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected use of { force: true } option.

> 1 │ await page.locator(‘button’).click({ force: true });
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

The force option bypasses actionability checks and can lead to unreliable tests.

Fix the underlying issue instead of forcing the action.

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.

await page.locator('check').check({ force: true });
code-block.js:1:7 lint/nursery/noPlaywrightForceOption ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected use of { force: true } option.

> 1 │ await page.locator(‘check’).check({ force: true });
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

The force option bypasses actionability checks and can lead to unreliable tests.

Fix the underlying issue instead of forcing the action.

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.

await page.locator('input').fill('text', { force: true });
code-block.js:1:7 lint/nursery/noPlaywrightForceOption ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected use of { force: true } option.

> 1 │ await page.locator(‘input’).fill(‘text’, { force: true });
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

The force option bypasses actionability checks and can lead to unreliable tests.

Fix the underlying issue instead of forcing the action.

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.

await page.locator('button').click();
await page.locator('check').check();
await page.locator('input').fill('text');