@@ -20,6 +20,7 @@ describe('exportFunctions() function exporter test suite', () => {
20
20
'folder/new.func.ts' ,
21
21
'folder/not-a-func.ts' ,
22
22
'folder/nestedFolder/sample-func.func.ts' ,
23
+ 'folder/nestedFolder/sample-js-func.func.js' ,
23
24
] ;
24
25
const { name : tempFuncDir } = tmp . dirSync ( ) ;
25
26
const randOutput = Math . floor ( Math . random ( ) * 10 ) ;
@@ -49,7 +50,7 @@ describe('exportFunctions() function exporter test suite', () => {
49
50
__dirname : tempFuncDir ,
50
51
__filename : `${ tempFuncDir } /pretend-index.ts` ,
51
52
exports : { } ,
52
- searchGlob : '**/*.func.ts ' ,
53
+ searchGlob : '**/*.func.{ts,js} ' ,
53
54
...configObj ,
54
55
} ) ;
55
56
@@ -62,9 +63,9 @@ describe('exportFunctions() function exporter test suite', () => {
62
63
} ) ;
63
64
64
65
it ( 'should properly nest submodules found in directories' , ( ) => {
65
- expect ( exportTestFactory ( ) ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 4 ] ) , randOutput ) ;
66
- expect ( exportTestFactory ( ) ) . not . toHaveProperty ( filePathToPropertyPath ( testFiles [ 3 ] ) , randOutput ) ;
67
- expect ( exportTestFactory ( ) ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 6 ] ) , randOutput ) ;
66
+ expect ( exportTestFactory ( ) ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 4 ] ) , randOutput ) ; // func
67
+ expect ( exportTestFactory ( ) ) . not . toHaveProperty ( filePathToPropertyPath ( testFiles [ 3 ] ) , randOutput ) ; // empty folder
68
+ expect ( exportTestFactory ( ) ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 6 ] ) , randOutput ) ; // nested func
68
69
} ) ;
69
70
70
71
it ( 'should correctly apply camelCase to kebab-case named files' , ( ) => {
@@ -116,4 +117,9 @@ describe('exportFunctions() function exporter test suite', () => {
116
117
console . log ( output ) ;
117
118
expect ( output ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 4 ] ) , testFiles [ 4 ] ) ;
118
119
} ) ;
120
+
121
+ it ( 'can detect both js and ts files using updated glob search - new default' , ( ) => {
122
+ const output = exportTestFactory ( { exportPathMode : true } ) ;
123
+ expect ( output ) . toHaveProperty ( filePathToPropertyPath ( testFiles [ 7 ] ) , testFiles [ 7 ] ) ; // js file
124
+ } ) ;
119
125
} ) ;
0 commit comments