File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,9 +176,12 @@ function isModuleByFilePath(filePath, module) {
176176}
177177
178178const validFileExtensions = [ 'js' , 'ts' , 'gjs' , 'gts' ] ;
179+ const validTestFilePatterns = [ '-test' , '_test' ] ;
179180
180181function 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+ ) ;
182185}
183186
184187function isMirageDirectory ( fileName ) {
Original file line number Diff line number Diff line change @@ -136,13 +136,20 @@ describe('isMirageConfig', () => {
136136} ) ;
137137
138138describe ( 'isTestFile' , ( ) => {
139- it ( 'detects test files' , ( ) => {
139+ it ( 'detects test files ending with -test ' , ( ) => {
140140 expect ( emberUtils . isTestFile ( 'some-test.js' ) ) . toBeTruthy ( ) ;
141141 expect ( emberUtils . isTestFile ( 'some-test.ts' ) ) . toBeTruthy ( ) ;
142142 expect ( emberUtils . isTestFile ( 'some-test.gjs' ) ) . toBeTruthy ( ) ;
143143 expect ( emberUtils . isTestFile ( 'some-test.gts' ) ) . toBeTruthy ( ) ;
144144 } ) ;
145145
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+
146153 it ( 'does not detect other files' , ( ) => {
147154 expect ( emberUtils . isTestFile ( 'some-component.js' ) ) . toBeFalsy ( ) ;
148155 expect ( emberUtils . isTestFile ( 'my-testing-component.js' ) ) . toBeFalsy ( ) ;
You can’t perform that action at this time.
0 commit comments