Skip to content

Commit 38a559e

Browse files
authored
fix(prefer-web-first-assertions): Fix false positive (#384)
* Fix JS prototype chain issue * Lint
1 parent 4762bbd commit 38a559e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/rules/prefer-web-first-assertions.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,7 @@ runRuleTester('prefer-web-first-assertions', rule, {
10951095
{ code: test('let visible = await foo.isVisible()') },
10961096
{ code: test('const value = await bar["inputValue"]()') },
10971097
{ code: test('const isEditable = await baz[`isEditable`]()') },
1098+
{ code: test('await expect(await locator.toString()).toBe("something")') },
10981099
{
10991100
code: javascript`
11001101
import { expect } from '@playwright/test';

src/rules/prefer-web-first-assertions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default createRule({
8585
// Playwright method must be supported
8686
const method = getStringValue(call.callee.property)
8787
const methodConfig = methods[method]
88-
if (!methodConfig) return
88+
if (!Object.hasOwn(methods, method)) return
8989

9090
// Change the matcher
9191
const notModifier = fnCall.modifiers.find(

0 commit comments

Comments
 (0)