Skip to content

Commit 59d94e5

Browse files
committed
feat: don't schedule test and spec
1 parent 4fc74dc commit 59d94e5

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

crates/dt_scheduler/src/lib.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,28 @@ impl ParserCandidateScheduler {
104104
}
105105

106106
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
110129
}
111130

112131
fn collect_paths(path: &PathBuf) -> Vec<PathBuf> {

0 commit comments

Comments
 (0)