Skip to content

Commit 319b3ba

Browse files
jattasNIrajsite
andauthored
Disable no-await-in-loop for Playwright (#128)
# Justification #123 (won't mark it fixed until we uptake this in clients and remove suppressions) # Implementation Add a rule configuration and docs to the `index.js` for the Playwright ruleset. # Testing Built package locally, imported into an SLE codebase, and verified that violations no longer need to be suppressed. --------- Co-authored-by: Milan Raj <[email protected]>
1 parent 3187bb3 commit 319b3ba

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ configure ESLint for Angular projects**.
129129
130130
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.
131131

132-
**Note:** The Playwright configurations extend the TypeScript configurations, so it is not necessary for an application to extend them both.
132+
**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.
133133

134134
```js
135+
// This is an example .eslintrc.js in a Playwright-specific directory.
136+
// If Playwright files are mixed with other code, use an "overrides" file pattern to match only Playwright code.
135137
{
136138
extends: [
137139
'@ni/eslint-config-playwright',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Disable no-await-in-loop for Playwright",
4+
"packageName": "@ni/eslint-config-playwright",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/eslint-config-playwright/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ module.exports = {
44
'plugin:playwright/playwright-test'
55
],
66
rules: {
7+
/*
8+
In UI tests it is common to have a loop that performs async operations which must be sequential.
9+
For example, clicking on a list of elements one after another.
10+
While there are still some cases where the rule would suggest valid improvements, they are not common
11+
enough to justify the noise that comes from needing to suppress it.
12+
*/
13+
'no-await-in-loop': 'off',
14+
715
/*
816
Playwright marks this as recommended but configures it as 'warn'.
917
Deeply nested describe blocks are likely an indication that test files are too complicated.

0 commit comments

Comments
 (0)