Skip to content

Commit b552bbc

Browse files
committed
Improve current await-async-query selector
1 parent f583b4f commit b552bbc

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/rules/await-async-query.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ module.exports = {
2222

2323
create: function(context) {
2424
return {
25-
'CallExpression Identifier[name=/^find(All)?By.*/]'(node) {
25+
'CallExpression Identifier[name=/^find(All)?By(LabelText|PlaceholderText|Text|AltText|Title|DisplayValue|Role|TestId)$/]'(
26+
node
27+
) {
2628
let hasError = true;
2729
try {
2830
if (VALID_PARENTS.includes(node.parent.parent.type)) {

tests/lib/rules/await-async-query.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ ruleTester.run('await-async-query', rule, {
4646
return promise
4747
}`,
4848
},
49+
{
50+
code: `async () => {
51+
doSomething()
52+
const foo = findByNonExistingTestingLibraryQuery('foo')
53+
}
54+
`,
55+
},
4956
],
5057

5158
invalid: [

0 commit comments

Comments
 (0)