chore(deps): add eslint-plugin-playwright and fix invalid expects#40111
Open
przemyslvw wants to merge 1 commit intomicrosoft:mainfrom
Open
chore(deps): add eslint-plugin-playwright and fix invalid expects#40111przemyslvw wants to merge 1 commit intomicrosoft:mainfrom
przemyslvw wants to merge 1 commit intomicrosoft:mainfrom
Conversation
- Bump `concurrently` to ^9.0.0 to mitigate shell injection vulnerabilities. - Introduce `eslint-plugin-playwright` to enforce testing guardrails. - Set `playwright/no-wait-for-timeout` to `warn` to keep CI green while flagging tech debt. - Enforce `playwright/valid-expect` and `playwright/no-focused-test` as `error`. - Fix existing `valid-expect` violations: - Add missing `.toBeTruthy()` in `resource-timing.spec.ts`. - Remove redundant, matcher-less expects in `selectors-text.spec.ts`. - Add inline eslint-disable for intentional negative tests in `expect-boolean.spec.ts`.
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This PR introduces essential security updates and strengthens the testing guardrails at the linting stage, preventing common Playwright anti-patterns from slipping into the codebase.
concurrentlydependency is bumped to^9.0.0to address known shell injection vulnerabilities present in the6.xline.eslint-plugin-playwright. This creates a blind spot for testing anti-patterns (e.g., unawaited assertions, committedpage.pause(), or missing matchers).Changes
concurrentlyto^9.0.0and installedeslint-plugin-playwright.eslint.config.mjs):playwright/no-wait-for-timeoutas awarn. There are currently 71 instances of hard waits in the suite. Setting this towarnprevents breaking the CI while making the tech debt visible to developers.playwright/no-focused-testandplaywright/valid-expectaserrorto block future regressions during code review.valid-expectviolations (6 errors resolved):tests/library/resource-timing.spec.ts: Added missing.toBeTruthy()to an incomplete assertion.tests/page/selectors-text.spec.ts: Cleaned up 3 dead/redundantexpect(await locator.isVisible())calls that lacked matchers.tests/page/expect-boolean.spec.ts: Added// eslint-disable-next-line playwright/valid-expectto negative tests that intentionally pass incorrect types to verify error handling.Validation
npm run lintnow passes with0 errors, 71 warnings.