@@ -2,7 +2,10 @@ export * from './compat';
2
2
export * from './file-import' ;
3
3
export * from './types' ;
4
4
5
- const combineQueries = ( variants : string [ ] , methods : string [ ] ) : string [ ] => {
5
+ const combineQueries = (
6
+ variants : readonly string [ ] ,
7
+ methods : readonly string [ ]
8
+ ) : string [ ] => {
6
9
const combinedQueries : string [ ] = [ ] ;
7
10
variants . forEach ( ( variant ) => {
8
11
const variantPrefix = variant . replace ( 'By' , '' ) ;
@@ -25,14 +28,19 @@ const LIBRARY_MODULES = [
25
28
'@testing-library/vue' ,
26
29
'@testing-library/svelte' ,
27
30
'@marko/testing-library' ,
28
- ] ;
31
+ ] as const ;
29
32
30
- const SYNC_QUERIES_VARIANTS = [ 'getBy' , 'getAllBy' , 'queryBy' , 'queryAllBy' ] ;
31
- const ASYNC_QUERIES_VARIANTS = [ 'findBy' , 'findAllBy' ] ;
33
+ const SYNC_QUERIES_VARIANTS = [
34
+ 'getBy' ,
35
+ 'getAllBy' ,
36
+ 'queryBy' ,
37
+ 'queryAllBy' ,
38
+ ] as const ;
39
+ const ASYNC_QUERIES_VARIANTS = [ 'findBy' , 'findAllBy' ] as const ;
32
40
const ALL_QUERIES_VARIANTS = [
33
41
...SYNC_QUERIES_VARIANTS ,
34
42
...ASYNC_QUERIES_VARIANTS ,
35
- ] ;
43
+ ] as const ;
36
44
37
45
const ALL_QUERIES_METHODS = [
38
46
'ByLabelText' ,
@@ -43,7 +51,7 @@ const ALL_QUERIES_METHODS = [
43
51
'ByDisplayValue' ,
44
52
'ByRole' ,
45
53
'ByTestId' ,
46
- ] ;
54
+ ] as const ;
47
55
48
56
const SYNC_QUERIES_COMBINATIONS = combineQueries (
49
57
SYNC_QUERIES_VARIANTS ,
@@ -58,7 +66,7 @@ const ASYNC_QUERIES_COMBINATIONS = combineQueries(
58
66
const ALL_QUERIES_COMBINATIONS = [
59
67
...SYNC_QUERIES_COMBINATIONS ,
60
68
...ASYNC_QUERIES_COMBINATIONS ,
61
- ] ;
69
+ ] as const ;
62
70
63
71
const ASYNC_UTILS = [ 'waitFor' , 'waitForElementToBeRemoved' ] as const ;
64
72
@@ -73,7 +81,7 @@ const DEBUG_UTILS = [
73
81
74
82
const EVENTS_SIMULATORS = [ 'fireEvent' , 'userEvent' ] as const ;
75
83
76
- const TESTING_FRAMEWORK_SETUP_HOOKS = [ 'beforeEach' , 'beforeAll' ] ;
84
+ const TESTING_FRAMEWORK_SETUP_HOOKS = [ 'beforeEach' , 'beforeAll' ] as const ;
77
85
78
86
const PROPERTIES_RETURNING_NODES = [
79
87
'activeElement' ,
@@ -93,7 +101,7 @@ const PROPERTIES_RETURNING_NODES = [
93
101
'previousSibling' ,
94
102
'rootNode' ,
95
103
'scripts' ,
96
- ] ;
104
+ ] as const ;
97
105
98
106
const METHODS_RETURNING_NODES = [
99
107
'closest' ,
@@ -104,20 +112,20 @@ const METHODS_RETURNING_NODES = [
104
112
'getElementsByTagNameNS' ,
105
113
'querySelector' ,
106
114
'querySelectorAll' ,
107
- ] ;
115
+ ] as const ;
108
116
109
117
const ALL_RETURNING_NODES = [
110
118
...PROPERTIES_RETURNING_NODES ,
111
119
...METHODS_RETURNING_NODES ,
112
- ] ;
120
+ ] as const ;
113
121
114
122
const PRESENCE_MATCHERS = [
115
123
'toBeOnTheScreen' ,
116
124
'toBeInTheDocument' ,
117
125
'toBeTruthy' ,
118
126
'toBeDefined' ,
119
- ] ;
120
- const ABSENCE_MATCHERS = [ 'toBeNull' , 'toBeFalsy' ] ;
127
+ ] as const ;
128
+ const ABSENCE_MATCHERS = [ 'toBeNull' , 'toBeFalsy' ] as const ;
121
129
122
130
export {
123
131
combineQueries ,
0 commit comments