File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,12 @@ const LIBRARY_MODULES = [
3333
3434const USER_EVENT_MODULE = '@testing-library/user-event' ;
3535
36+ const OLD_LIBRARY_MODULES = [
37+ 'dom-testing-library' ,
38+ 'vue-testing-library' ,
39+ 'react-testing-library' ,
40+ ] as const ;
41+
3642const SYNC_QUERIES_VARIANTS = [
3743 'getBy' ,
3844 'getAllBy' ,
@@ -154,4 +160,5 @@ export {
154160 ABSENCE_MATCHERS ,
155161 EVENT_HANDLER_METHODS ,
156162 USER_EVENT_MODULE ,
163+ OLD_LIBRARY_MODULES ,
157164} ;
Original file line number Diff line number Diff line change 1+ import { TestingLibrarySettings } from '../create-testing-library-rule/detect-testing-library-utils' ;
2+
3+ import { LIBRARY_MODULES , OLD_LIBRARY_MODULES , USER_EVENT_MODULE } from '.' ;
4+
5+ export const isOfficialTestingLibraryModule = ( importSourceName : string ) =>
6+ [ ...OLD_LIBRARY_MODULES , ...LIBRARY_MODULES , USER_EVENT_MODULE ] . includes (
7+ importSourceName
8+ ) ;
9+
10+ export const isCustomTestingLibraryModule = (
11+ importSourceName : string ,
12+ customModuleSetting : TestingLibrarySettings [ 'testing-library/utils-module' ]
13+ ) =>
14+ typeof customModuleSetting === 'string' &&
15+ importSourceName . endsWith ( customModuleSetting ) ;
16+
17+ export const isTestingLibraryModule = (
18+ importSourceName : string ,
19+ customModuleSetting ?: TestingLibrarySettings [ 'testing-library/utils-module' ]
20+ ) =>
21+ isOfficialTestingLibraryModule ( importSourceName ) ||
22+ isCustomTestingLibraryModule ( importSourceName , customModuleSetting ) ;
You can’t perform that action at this time.
0 commit comments