File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ class AvaFiles {
205
205
const initialPatterns = this . files . concat ( excludePatterns ) ;
206
206
207
207
// Like in `api.js`, tests must be `.js` files and not start with `_`
208
- if ( path . extname ( filePath ) !== '.js' || path . basename ( filePath ) [ 0 ] === '_' ) {
208
+ if ( ! this . extensions . includes ( path . extname ( filePath ) . substring ( 1 ) ) || path . basename ( filePath ) [ 0 ] === '_' ) {
209
209
return false ;
210
210
}
211
211
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ test('ignores relativeness in patterns', t => {
25
25
} ) ;
26
26
27
27
test ( 'testMatcher' , t => {
28
- const avaFiles = new AvaFiles ( { files : [ '**/foo*' ] } ) ;
28
+ const avaFiles = new AvaFiles ( { files : [ '**/foo*' ] , extensions : [ 'js' , 'ts' ] } ) ;
29
29
30
30
function isTest ( file ) {
31
31
t . true ( avaFiles . isTest ( file ) , `${ file } should be a test` ) ;
@@ -40,6 +40,7 @@ test('testMatcher', t => {
40
40
isTest ( 'foo/blah.js' ) ;
41
41
isTest ( 'bar/foo.js' ) ;
42
42
isTest ( 'bar/foo-bar/baz/buz.js' ) ;
43
+ isTest ( 'foo-bar.ts' ) ;
43
44
notTest ( 'bar/baz/buz.js' ) ;
44
45
notTest ( 'bar.js' ) ;
45
46
notTest ( 'bar/bar.js' ) ;
@@ -49,6 +50,7 @@ test('testMatcher', t => {
49
50
notTest ( 'node_modules/foo.js' ) ;
50
51
notTest ( 'fixtures/foo.js' ) ;
51
52
notTest ( 'helpers/foo.js' ) ;
53
+ notTest ( 'foo-bar.unknown-ext' ) ;
52
54
t . end ( ) ;
53
55
} ) ;
54
56
You can’t perform that action at this time.
0 commit comments