@@ -88,6 +88,13 @@ const FIRE_EVENT_FUNCTIONS = [
8888 'gotPointerCapture' ,
8989 'lostPointerCapture' ,
9090] ;
91+ const SUPPORTED_TESTING_FRAMEWORKS = [
92+ '@testing-library/dom' ,
93+ '@testing-library/angular' ,
94+ '@testing-library/react' ,
95+ '@testing-library/vue' ,
96+ '@marko/testing-library' ,
97+ ] ;
9198const USER_EVENT_SYNC_FUNCTIONS = [
9299 'clear' ,
93100 'click' ,
@@ -168,15 +175,17 @@ ruleTester.run(RULE_NAME, rule, {
168175 } ,
169176
170177 // valid tests for fire-event when only user-event set in eventModules
171- ...FIRE_EVENT_FUNCTIONS . map ( ( func ) => ( {
172- code : `
173- import { fireEvent } from '@testing-library/framework';
174- test('should not report fireEvent.${ func } sync event awaited', async() => {
175- await fireEvent.${ func } ('foo');
176- });
177- ` ,
178- options : [ { eventModules : [ 'user-event' ] } ] ,
179- } ) ) ,
178+ ...SUPPORTED_TESTING_FRAMEWORKS . flatMap ( ( testingFramework ) =>
179+ FIRE_EVENT_FUNCTIONS . map ( ( func ) => ( {
180+ code : `
181+ import { fireEvent } from '${ testingFramework } ';
182+ test('should not report fireEvent.${ func } sync event awaited', async() => {
183+ await fireEvent.${ func } ('foo');
184+ });
185+ ` ,
186+ options : [ { eventModules : [ 'user-event' ] } ] ,
187+ } ) )
188+ ) ,
180189
181190 // valid tests for user-event when only fire-event set in eventModules
182191 ...USER_EVENT_SYNC_FUNCTIONS . map ( ( func ) => ( {
@@ -192,24 +201,26 @@ ruleTester.run(RULE_NAME, rule, {
192201
193202 invalid : [
194203 // sync fireEvent methods with await operator are not valid
195- ...FIRE_EVENT_FUNCTIONS . map (
196- ( func ) =>
197- ( {
198- code : `
199- import { fireEvent } from '@testing-library/framework';
204+ ...SUPPORTED_TESTING_FRAMEWORKS . flatMap ( ( testingFramework ) =>
205+ FIRE_EVENT_FUNCTIONS . map (
206+ ( func ) =>
207+ ( {
208+ code : `
209+ import { fireEvent } from '${ testingFramework } ';
200210 test('should report fireEvent.${ func } sync event awaited', async() => {
201211 await fireEvent.${ func } ('foo');
202212 });
203213 ` ,
204- errors : [
205- {
206- line : 4 ,
207- column : 17 ,
208- messageId : 'noAwaitSyncEvents' ,
209- data : { name : `fireEvent.${ func } ` } ,
210- } ,
211- ] ,
212- } as const )
214+ errors : [
215+ {
216+ line : 4 ,
217+ column : 17 ,
218+ messageId : 'noAwaitSyncEvents' ,
219+ data : { name : `fireEvent.${ func } ` } ,
220+ } ,
221+ ] ,
222+ } as const )
223+ )
213224 ) ,
214225 // sync userEvent sync methods with await operator are not valid
215226 ...USER_EVENT_SYNC_FUNCTIONS . map (
@@ -234,25 +245,27 @@ ruleTester.run(RULE_NAME, rule, {
234245
235246 // sync fireEvent methods with await operator are not valid
236247 // when only fire-event set in eventModules
237- ...FIRE_EVENT_FUNCTIONS . map (
238- ( func ) =>
239- ( {
240- code : `
241- import { fireEvent } from '@testing-library/framework';
248+ ...SUPPORTED_TESTING_FRAMEWORKS . flatMap ( ( testingFramework ) =>
249+ FIRE_EVENT_FUNCTIONS . map (
250+ ( func ) =>
251+ ( {
252+ code : `
253+ import { fireEvent } from '${ testingFramework } ';
242254 test('should report fireEvent.${ func } sync event awaited', async() => {
243255 await fireEvent.${ func } ('foo');
244256 });
245257 ` ,
246- options : [ { eventModules : [ 'fire-event' ] } ] ,
247- errors : [
248- {
249- line : 4 ,
250- column : 17 ,
251- messageId : 'noAwaitSyncEvents' ,
252- data : { name : `fireEvent.${ func } ` } ,
253- } ,
254- ] ,
255- } as const )
258+ options : [ { eventModules : [ 'fire-event' ] } ] ,
259+ errors : [
260+ {
261+ line : 4 ,
262+ column : 17 ,
263+ messageId : 'noAwaitSyncEvents' ,
264+ data : { name : `fireEvent.${ func } ` } ,
265+ } ,
266+ ] ,
267+ } as const )
268+ )
256269 ) ,
257270 // sync userEvent sync methods with await operator are not valid
258271 // when only fire-event set in eventModules
0 commit comments