-
Notifications
You must be signed in to change notification settings - Fork 152
Labels
bugSomething isn't workingSomething isn't working
Description
Have you read the Troubleshooting section?
Yes
Plugin version
7.6.1
ESLint version
8.57.0
Node.js version
20.11
Bug description
We have a number of test cases where we expect async queries to fail, and then we either make assertions against the failure, or throw an error to indicate a particular failure mode. However, async queries with .catch()
chained are not considered "handled" promises by the plugin.
For example, when testing a custom query:
screen.findByMyCustomQuery('thing-that-doesnt-exist').catch((err) => {
expect(err.message).toMatch(...)
});
These tests could be re-written to explicitly use async matchers, but this should be a valid pattern as far as I can tell.
Steps to reproduce
add this to the valid
entries in the await-async-queries
test suite:
...createTestCase(
(query) => `
${query}('foo').catch((error) => {
expect(error.message).toMatch(/my error message/)
})
`
)
Error output/screenshots
No response
ESLint configuration
n/a
Rule(s) affected
await-async-queries
, await-async-utils
, await-async-events
Anything else?
No response
Do you want to submit a pull request to fix this bug?
Yes
Belco90
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working