@@ -103,10 +103,10 @@ class TestData {
103
103
* Find all files recursively in specific folder with specific extension, e.g:
104
104
* findFilesInDir('./project/src', '.html') ==> ['./project/src/a.html','./project/src/build/index.html']
105
105
* @param {String } startPath Path relative to this file or other file which requires this files
106
- * @param {String } filter Extension name, e.g: '.html'
106
+ * @param {String } extension Extension name, e.g: '.html'
107
107
* @return {Array } Result files with path string in an array
108
108
*/
109
- findFilesInDir = ( pathFromDataFolder , filter : string ) : Array < string > => {
109
+ findFilesInDir = ( pathFromDataFolder , extension : string ) : Array < string > => {
110
110
const startPath = this . getFullPath ( `${ pathFromDataFolder } ` ) ;
111
111
let results = [ ] ;
112
112
@@ -120,8 +120,8 @@ class TestData {
120
120
const filename = path . join ( startPath , files [ i ] ) ;
121
121
const stat = fs . lstatSync ( filename ) ;
122
122
if ( stat . isDirectory ( ) ) {
123
- results = results . concat ( this . findFilesInDir ( filename , filter ) ) ;
124
- } else if ( filename . indexOf ( filter ) >= 0 ) {
123
+ results = results . concat ( this . findFilesInDir ( filename , extension ) ) ;
124
+ } else if ( filename . endsWith ( extension ) ) {
125
125
logger . info ( `Found File: ${ filename } ` ) ;
126
126
results . push ( filename ) ;
127
127
}
0 commit comments