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

Cannot read properties of undefined (reading 'type') #276

Closed
VictorGlindasPaf opened this issue Mar 18, 2024 · 3 comments
Closed

Cannot read properties of undefined (reading 'type') #276

VictorGlindasPaf opened this issue Mar 18, 2024 · 3 comments
Labels

Comments

@VictorGlindasPaf
Copy link

VictorGlindasPaf commented Mar 18, 2024

After updating from 1.3.1 to 1.5.2, the following code throws an exception when linting:

import { expect } from '@playwright/test';
...
 await expect 
    .poll(() => getMockHistory(received), { message })
    .toEqual(expect.objectContaining({ calls: 1, data, query: query ?? expect.anything() }));

The exception:

TypeError: Cannot read properties of undefined (reading 'type')
Occurred while linting /Users/vicgli/Documents/Repositories/paf-backoffice/app/tests/utils/expects.ts:28
Rule: "playwright/prefer-web-first-assertions"
    at dereference (/Users/vicgli/Documents/Repositories/paf-backoffice/node_modules/eslint-plugin-playwright/dist/index.js:2633:12)
    at CallExpression (/Users/vicgli/Documents/Repositories/paf-backoffice/node_modules/eslint-plugin-playwright/dist/index.js:2654:21)
    at ruleErrorHandler (/Users/vicgli/Documents/Repositories/paf-backoffice/node_modules/eslint/lib/linter/linter.js:1076:28)
    at /Users/vicgli/Documents/Repositories/paf-backoffice/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/vicgli/Documents/Repositories/paf-backoffice/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/vicgli/Documents/Repositories/paf-backoffice/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (/Users/vicgli/Documents/Repositories/paf-backoffice/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (/Users/vicgli/Documents/Repositories/paf-backoffice/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
    at CodePathAnalyzer.enterNode (/Users/vicgli/Documents/Repositories/paf-backoffice/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:803:23)
@greggb
Copy link

greggb commented Mar 19, 2024

Same here. I bumped versions incrementally and 1.4.0 is the culprit release that started showing this error.

Unsure if this is related, but since upgrading any files inside a test or __test__ directory anywhere in my project are being linted by this plugin rather than just playwright tests.

@mskelton
Copy link
Member

Unsure if this is related, but since upgrading any files inside a test or __test__ directory anywhere in my project are being linted by this plugin rather than just playwright tests.

@greggb Indeed unrelated, but in general when using this plugin you should scope it to only the directory containing your Playwright tests.

Copy link

🎉 This issue has been resolved in version 1.5.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants