Back to Biomejs

noPlaywrightPagePause

src/content/docs/linter/rules/no-playwright-page-pause.mdx

latest6.8 KB
Original Source

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/noPlaywrightPagePause`](/reference/diagnostics#diagnostic-category) - This rule doesn't have a 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/no-page-pause`](https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-page-pause.md)

How to configure

json
{
	"linter": {
		"rules": {
			"nursery": {
				"noPlaywrightPagePause": "error"
			}
		}
	}
}

Description

Disallow using page.pause().

Playwright's page.pause() is a debugging utility that should not be committed to version control. It pauses test execution and opens the Playwright Inspector, which is useful during development but should not be present in production test code.

Examples

Invalid

js
await page.pause();
<pre class="language-text"><code class="language-text">code-block.js:1:7 <a href="https://biomejs.dev/linter/rules/no-playwright-page-pause">lint/nursery/noPlaywrightPagePause</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Unexpected use of </span><span style="color: lightgreen;"><strong>page.pause()</strong></span><span style="color: lightgreen;">.</span> <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>await page.pause(); <strong> │ </strong> <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong> <strong>2 │ </strong> <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;"><strong>page.pause()</strong></span><span style="color: lightgreen;"> is a debugging utility and should not be committed to version control.</span> <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Remove the </span><span style="color: lightgreen;"><strong>pause()</strong></span><span style="color: lightgreen;"> call or use a proper debugging strategy.</span> <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit </span><span style="color: lightgreen;"><a href="https://biomejs.dev/linter/#nursery">https://biomejs.dev/linter/#nursery</a></span><span style="color: lightgreen;"> for more information.</span> </code></pre>
js
test('example', async ({ page }) => {
    await page.click('button');
    await page.pause();
});
<pre class="language-text"><code class="language-text">code-block.js:3:11 <a href="https://biomejs.dev/linter/rules/no-playwright-page-pause">lint/nursery/noPlaywrightPagePause</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Unexpected use of </span><span style="color: lightgreen;"><strong>page.pause()</strong></span><span style="color: lightgreen;">.</span> <strong>1 │ </strong>test('example', async (&#123; page &#125;) =&gt; &#123; <strong>2 │ </strong> await page.click('button'); <strong><span style="color: Tomato;">&gt;</span></strong> <strong>3 │ </strong> await page.pause(); <strong> │ </strong> <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong> <strong>4 │ </strong>&#125;); <strong>5 │ </strong> <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;"><strong>page.pause()</strong></span><span style="color: lightgreen;"> is a debugging utility and should not be committed to version control.</span> <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Remove the </span><span style="color: lightgreen;"><strong>pause()</strong></span><span style="color: lightgreen;"> call or use a proper debugging strategy.</span> <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit </span><span style="color: lightgreen;"><a href="https://biomejs.dev/linter/#nursery">https://biomejs.dev/linter/#nursery</a></span><span style="color: lightgreen;"> for more information.</span> </code></pre>

Valid

js
test('example', async ({ page }) => {
    await page.click('button');
    await expect(page.locator('.result')).toBeVisible();
});
</TabItem> </Tabs>