Skip to content

Commit 9d48f3c

Browse files
committed
Merge remote-tracking branch 'testing-library/main' into fix/742-get-property-identifier-node-await-expression
2 parents eb4c965 + 7077485 commit 9d48f3c

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Bug Report
22
description: File a bug report
33
labels: ['bug', 'triage']
4+
type: bug
45
body:
56
- type: dropdown
67
id: read_troubleshooting
@@ -40,24 +41,6 @@ body:
4041
validations:
4142
required: true
4243

43-
- type: input
44-
id: npm_yarn_version
45-
attributes:
46-
label: package manager and version
47-
description: Tell us package manager you are using, and what version.
48-
placeholder: npm 6.14.13
49-
validations:
50-
required: true
51-
52-
- type: input
53-
id: operating_system
54-
attributes:
55-
label: Operating system
56-
description: Tell us what operating system you use, and what version.
57-
placeholder: macOS Big Sur, version 11.4
58-
validations:
59-
required: true
60-
6144
- type: textarea
6245
id: bug_description
6346
attributes:

.github/ISSUE_TEMPLATE/propose_new_rule.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Propose a new rule
22
description: Propose a new rule for the eslint-plugin-testing-library.
33
labels: ['new rule', 'triage']
4+
type: feature
45
body:
56
- type: input
67
id: name_for_new_rule

.github/ISSUE_TEMPLATE/request_general_change.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Request a general change
22
description: Request a general change for the eslint-plugin-testing-library.
33
labels: ['enhancement', 'triage']
4+
type: task
45
body:
56
- type: input
67
id: plugin_version

.github/ISSUE_TEMPLATE/request_rule_change.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Request a rule change
22
description: Request a rule change for the eslint-plugin-testing-library.
33
labels: ['enhancement', 'triage']
4+
type: feature
45
body:
56
- type: input
67
id: what_rule_do_you_want_to_change

lib/node-utils/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@ function getRootExpression(
278278
return parent.expressions[parent.expressions.length - 1] === expression
279279
? getRootExpression(parent)
280280
: expression;
281+
282+
case AST_NODE_TYPES.ChainExpression:
283+
return getRootExpression(parent);
284+
281285
default:
282286
return expression;
283287
}

tests/lib/rules/await-async-queries.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,21 @@ ruleTester.run(RULE_NAME, rule, {
9393
// async screen queries declaration are valid
9494
...createTestCase((query) => `await screen.${query}('foo')`),
9595

96+
// async queries with optional chaining are valid
97+
...createTestCase((query) => `await screen?.${query}('foo')`),
98+
99+
...createTestCase(
100+
(query) => `
101+
it('test case', async () => {
102+
let renderResult: RenderResult | undefined;
103+
104+
renderResult = render(<div>text</div>);
105+
106+
expect(await renderResult?.${query}('text')).toBeDefined();
107+
});
108+
`
109+
),
110+
96111
// async @marko/testing-library screen queries declaration are valid
97112
...createTestCase((query) => `await screen.${query}('foo')`, {
98113
testingFramework: '@marko/testing-library',

0 commit comments

Comments
 (0)