@@ -57,7 +57,7 @@ ruleTester.run(RULE_NAME, rule, {
5757 code : `
5858 import { render } from '${ testingFramework } '
5959 import { ${ query } } from 'custom-queries'
60-
60+
6161 test("imported custom queries, since they can't be used through screen", () => {
6262 render(foo)
6363 ${ query } ('bar')
@@ -67,7 +67,7 @@ ruleTester.run(RULE_NAME, rule, {
6767 ...CUSTOM_QUERY_COMBINATIONS . map ( ( query ) => ( {
6868 code : `
6969 import { render } from '${ testingFramework } '
70-
70+
7171 test("render-returned custom queries, since they can't be used through screen", () => {
7272 const { ${ query } } = render(foo)
7373 ${ query } ('bar')
@@ -80,13 +80,22 @@ ruleTester.run(RULE_NAME, rule, {
8080 } ,
8181 code : `
8282 import { render } from '${ testingFramework } '
83-
83+
8484 test("custom queries + custom-queries setting, since they can't be used through screen", () => {
8585 const { ${ query } } = render(foo)
8686 ${ query } ('bar')
8787 })
8888 ` ,
8989 } ) ) ,
90+ {
91+ code : `
92+ import { screen as rtlScreen } from '${ testingFramework } '
93+
94+ test("test", () => {
95+ rtlScreen.getByText('hoge');
96+ })
97+ ` ,
98+ } ,
9099 ] ) ,
91100 {
92101 code : `
@@ -136,6 +145,16 @@ ruleTester.run(RULE_NAME, rule, {
136145 utils.unmount();
137146 ` ,
138147 } ,
148+ {
149+ settings : { 'testing-library/utils-module' : 'test-utils' } ,
150+ code : `
151+ import { screen as rtlScreen } from 'test-utils'
152+
153+ test("test", () => {
154+ rtlScreen.getByText('hoge');
155+ })
156+ ` ,
157+ } ,
139158 ...ALL_QUERIES_COMBINATIONS . map ( ( queryMethod : string ) => ( {
140159 code : `
141160 const { ${ queryMethod } } = render(baz, { baseElement: treeA })
0 commit comments