File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -176,9 +176,12 @@ function isModuleByFilePath(filePath, module) {
176
176
}
177
177
178
178
const validFileExtensions = [ 'js' , 'ts' , 'gjs' , 'gts' ] ;
179
+ const validTestFilePatterns = [ '-test' , '_test' ] ;
179
180
180
181
function isTestFile ( fileName ) {
181
- return validFileExtensions . some ( ( ext ) => fileName . endsWith ( `-test.${ ext } ` ) ) ;
182
+ return validFileExtensions . some ( ( ext ) =>
183
+ validTestFilePatterns . some ( ( testFilePattern ) => fileName . endsWith ( `${ testFilePattern } .${ ext } ` ) )
184
+ ) ;
182
185
}
183
186
184
187
function isMirageDirectory ( fileName ) {
Original file line number Diff line number Diff line change @@ -136,13 +136,20 @@ describe('isMirageConfig', () => {
136
136
} ) ;
137
137
138
138
describe ( 'isTestFile' , ( ) => {
139
- it ( 'detects test files' , ( ) => {
139
+ it ( 'detects test files ending with -test ' , ( ) => {
140
140
expect ( emberUtils . isTestFile ( 'some-test.js' ) ) . toBeTruthy ( ) ;
141
141
expect ( emberUtils . isTestFile ( 'some-test.ts' ) ) . toBeTruthy ( ) ;
142
142
expect ( emberUtils . isTestFile ( 'some-test.gjs' ) ) . toBeTruthy ( ) ;
143
143
expect ( emberUtils . isTestFile ( 'some-test.gts' ) ) . toBeTruthy ( ) ;
144
144
} ) ;
145
145
146
+ it ( 'detects test files ending with _test' , ( ) => {
147
+ expect ( emberUtils . isTestFile ( 'some_test.js' ) ) . toBeTruthy ( ) ;
148
+ expect ( emberUtils . isTestFile ( 'some_test.ts' ) ) . toBeTruthy ( ) ;
149
+ expect ( emberUtils . isTestFile ( 'some_test.gjs' ) ) . toBeTruthy ( ) ;
150
+ expect ( emberUtils . isTestFile ( 'some_test.gts' ) ) . toBeTruthy ( ) ;
151
+ } ) ;
152
+
146
153
it ( 'does not detect other files' , ( ) => {
147
154
expect ( emberUtils . isTestFile ( 'some-component.js' ) ) . toBeFalsy ( ) ;
148
155
expect ( emberUtils . isTestFile ( 'my-testing-component.js' ) ) . toBeFalsy ( ) ;
You can’t perform that action at this time.
0 commit comments