ESLint plugin for your Playwright testing needs.
Yarn
yarn add -D eslint-plugin-playwright
NPM
npm install -D eslint-plugin-playwright
This plugin bundles two configurations to work with both @playwright/test
or
jest-playwright
.
{
"extends": ["plugin:playwright/playwright-test"]
}
With Jest Playwright
{
"extends": ["plugin:playwright/jest-playwright"]
}
β: Enabled in the recommended configuration.
π§: Some problems reported by this rule are automatically fixable by the --fix
command line option.
π‘: Some problems reported by this rule are manually fixable by editor
suggestions.
β | π§ | π‘ | Rule | Description |
---|---|---|---|---|
β | max-nested-describe | Enforces a maximum depth to nested describe calls | ||
β | π§ | missing-playwright-await | Enforce Playwright APIs to be awaited | |
β | no-conditional-in-test | Disallow conditional logic in tests | ||
β | π‘ | no-element-handle | Disallow usage of element handles | |
β | no-eval | Disallow usage of page.$eval and page.$$eval |
||
β | π‘ | no-focused-test | Disallow usage of .only annotation |
|
β | no-force-option | Disallow usage of the { force: true } option |
||
β | no-page-pause | Disallow using page.pause |
||
no-restricted-matchers | Disallow specific matchers & modifiers | |||
β | π‘ | no-skipped-test | Disallow usage of the .skip annotation |
|
β | π§ | no-useless-not | Disallow usage of not matchers when a specific matcher exists |
|
β | π‘ | no-wait-for-timeout | Disallow usage of page.waitForTimeout |
|
π‘ | prefer-strict-equal | Suggest using toStrictEqual() |
||
π§ | prefer-lowercase-title | Enforce lowercase test names | ||
π§ | prefer-to-be | Suggest using toBe() |
||
π§ | prefer-to-have-length | Suggest using toHaveLength() |
||
require-top-level-describe | Require test cases and hooks to be inside a test.describe block |
|||
π§ | require-soft-assertions | Require assertions to use expect.soft() |
||
β | valid-expect | Enforce valid expect() usage |