File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -104,9 +104,28 @@ impl ParserCandidateScheduler {
104
104
}
105
105
106
106
fn is_valid_path ( path : & PathBuf ) -> bool {
107
- path. is_file ( )
108
- && path. extension ( ) . is_some ( )
109
- && [ "ts" , "tsx" , "js" , "jsx" ] . contains ( & path. extension ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) )
107
+ if !path. is_file ( ) {
108
+ return false ;
109
+ }
110
+ let path_str = path. to_str ( ) . expect ( & format ! ( "to_str() for {:?}" , path) ) ;
111
+ if path_str. ends_with ( ".js" )
112
+ || path_str. ends_with ( ".jsx" )
113
+ || path_str. ends_with ( ".ts" )
114
+ || path_str. ends_with ( ".tsx" )
115
+ {
116
+ if !path_str. ends_with ( ".spec.js" )
117
+ && !path_str. ends_with ( ".spec.jsx" )
118
+ && !path_str. ends_with ( ".spec.ts" )
119
+ && !path_str. ends_with ( ".spec.tsx" )
120
+ && !path_str. ends_with ( ".test.js" )
121
+ && !path_str. ends_with ( ".test.jsx" )
122
+ && !path_str. ends_with ( ".test.ts" )
123
+ && !path_str. ends_with ( ".test.tsx" )
124
+ {
125
+ return true ;
126
+ }
127
+ }
128
+ false
110
129
}
111
130
112
131
fn collect_paths ( path : & PathBuf ) -> Vec < PathBuf > {
You can’t perform that action at this time.
0 commit comments