Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable no-await-in-loop for Playwright #128

Merged
merged 6 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ configure ESLint for Angular projects**.

Extend `@ni/eslint-config-playwright` and `@ni/eslint-config-playwright/requiring-type-checking` in the [ESLint configuration](https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats). Set the `parserOptions.project` configuration to the project's TypeScript configuration.

**Note:** The Playwright configurations extend the TypeScript configurations, so it is not necessary for an application to extend them both.
**Note:** The Playwright configurations extend the TypeScript configurations, so it is not necessary for an application to extend them both. However, the Playwright configurations should only be applied to directories that contain Playwright tests and utilities.

```js
// This is an example .eslintrc.js in a Playwright-specific directory.
// If Playwright files are mixed with other code, use an "overrides" file pattern to match only Playwright code.
{
extends: [
'@ni/eslint-config-playwright',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
rajsite marked this conversation as resolved.
Show resolved Hide resolved
"type": "patch",
"comment": "Disable no-await-in-loop for Playwright",
"packageName": "@ni/eslint-config-playwright",
"email": "[email protected]",
"dependentChangeType": "patch"
}
8 changes: 8 additions & 0 deletions packages/eslint-config-playwright/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ module.exports = {
'plugin:playwright/playwright-test'
],
rules: {
/*
In UI tests it is common to have a loop that performs async operations which must be sequential.
For example, clicking on a list of elements one after another.
While there are still some cases where the rule would suggest valid improvements, they are not common
enough to justify the noise that comes from needing to suppress it.
*/
'no-await-in-loop': 'off',

/*
Playwright marks this as recommended but configures it as 'warn'.
Deeply nested describe blocks are likely an indication that test files are too complicated.
Expand Down