ESLint Jest Playwright
ESLint plugin for your Jest Playwright (jest-playwright) installation.
Installation
Yarn
yarn add -D eslint-plugin-jest-playwright
NPM
npm install -D eslint-plugin-jest-playwright
Usage
Add plugin:jest-playwright/recommended
to your extends ESLint configuration. For example:
{
"extends": ["plugin:jest-playwright/recommended"],
"plugins": ["jest-playwright"]
}
Rules
missing-playwright-expect
🔧
Enforce Jest Playwright expect statements to be awaited.
Example
Example of incorrect code for this rule:
expect(page).toHaveText("text");
Example of correct code for this rule:
await expect(page).toHaveText("text");
Options
The rule accepts a non-required option which can be used to specify custom matchers which this rule should also warn about. This is useful when creating your own async matchers.
{
"jest-playwright/missing-playwright-await": [
"error",
{ "customMatchers": ["toHaveAttribute"] }
]
}