await-async-utils false positive on chained cy.wait().its().then()
See original GitHub issuePlugin version
v5.1.0
ESLint version
v8.12.0
Node.js version
16.14.0
npm/yarn version
npm 8.3.1
Operating system
macOS Big Sur 11.6
Bug description
cy.wait
getting picked up by testing-library/await-async-utils
on a line like…
cy.wait(`@${label}`, { timeout: 1000 * 60 * 3 })
.its('status')
.then(status => expect(status).to.be.oneOf([200, 304]));
The rule documentation says chaining is ok. I assume it’s the its
that’s complicating things.
Thanks!
Steps to reproduce
Got to get back to work. I hope this helps. Thanks!
Error output/screenshots
No response
ESLint configuration
Got to get back to work. I hope this helps. Thanks!
Rule(s) affected
testing-library/await-async-utils
Anything else?
Thank you!
Do you want to submit a pull request to fix this bug?
No
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
wait - Cypress Documentation
When given a time argument: cy.wait() yields the same subject it was given. It is unsafe to chain further commands that rely on...
Read more >Explain how commands are chained better in "cy.wait" examples
Based on a conversation with a user who was chaining cy.wait(alias).then(...) I have noticed that our cy.wait page only shows ...
Read more >8 common mistakes in Cypress (and how to avoid them)
#1: Using explicit waiting ... This first example feels kinda obvious. Whenever you added an explicit wait to your Cypress test, I believe...
Read more >How to wait for cypress command to finish before moving ...
testCommand() cy.then(() => { console.log('after command runs') }) }) }) ... It's due to the fact that non-cypress commands runs ...
Read more >Cypress Get Command | Difference between Get and Find ...
How to chain other Cypress commands with "get()" command? ... cy.get('input',{ timeout: 1000 }) // It will wait for 1000ms before timing out....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@cburgmer that was our original approach, but that would discard reporting related to Testing Library coming from non “testing-library” modules. It’s pretty common to re-export Testing Library utils from a custom module (e.g. “test-utils”). The plugin wouldn’t be aware of it. That’s why we have this Aggressive Reporting in place, leaving it up to you to narrow the scope with ESLint settings or the plugin settings.
You can read more about it here: https://github.com/testing-library/eslint-plugin-testing-library/issues/198
Could we re-open and find a better solution? After all this plugin seems to be very fuzzy at looking for occurrences of
findByRole
and similar functions used in testing-library. This could lead to errors in other implementations unrelated to testing-library as well.Currently indeed this is necessary in your .eslintrc: