diff options
Diffstat (limited to 'cli/tools/test_runner.rs')
-rw-r--r-- | cli/tools/test_runner.rs | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/cli/tools/test_runner.rs b/cli/tools/test_runner.rs index da0d760b5..4cc006ae1 100644 --- a/cli/tools/test_runner.rs +++ b/cli/tools/test_runner.rs @@ -25,7 +25,6 @@ use rand::seq::SliceRandom; use rand::SeedableRng; use regex::Regex; use serde::Deserialize; -use std::path::Path; use std::path::PathBuf; use std::sync::mpsc::channel; use std::sync::mpsc::Sender; @@ -195,30 +194,6 @@ fn create_reporter(concurrent: bool) -> Box<dyn TestReporter + Send> { Box::new(PrettyTestReporter::new(concurrent)) } -pub(crate) fn is_supported(p: &Path) -> bool { - use std::path::Component; - if let Some(Component::Normal(basename_os_str)) = p.components().next_back() { - let basename = basename_os_str.to_string_lossy(); - basename.ends_with("_test.ts") - || basename.ends_with("_test.tsx") - || basename.ends_with("_test.js") - || basename.ends_with("_test.mjs") - || basename.ends_with("_test.jsx") - || basename.ends_with(".test.ts") - || basename.ends_with(".test.tsx") - || basename.ends_with(".test.js") - || basename.ends_with(".test.mjs") - || basename.ends_with(".test.jsx") - || basename == "test.ts" - || basename == "test.tsx" - || basename == "test.js" - || basename == "test.mjs" - || basename == "test.jsx" - } else { - false - } -} - pub async fn test_specifier( program_state: Arc<ProgramState>, main_module: ModuleSpecifier, @@ -690,28 +665,3 @@ pub async fn run_tests( Ok(()) } - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_is_supported() { - assert!(is_supported(Path::new("tests/subdir/foo_test.ts"))); - assert!(is_supported(Path::new("tests/subdir/foo_test.tsx"))); - assert!(is_supported(Path::new("tests/subdir/foo_test.js"))); - assert!(is_supported(Path::new("tests/subdir/foo_test.jsx"))); - assert!(is_supported(Path::new("bar/foo.test.ts"))); - assert!(is_supported(Path::new("bar/foo.test.tsx"))); - assert!(is_supported(Path::new("bar/foo.test.js"))); - assert!(is_supported(Path::new("bar/foo.test.jsx"))); - assert!(is_supported(Path::new("foo/bar/test.js"))); - assert!(is_supported(Path::new("foo/bar/test.jsx"))); - assert!(is_supported(Path::new("foo/bar/test.ts"))); - assert!(is_supported(Path::new("foo/bar/test.tsx"))); - assert!(!is_supported(Path::new("README.md"))); - assert!(!is_supported(Path::new("lib/typescript.d.ts"))); - assert!(!is_supported(Path::new("notatest.js"))); - assert!(!is_supported(Path::new("NotAtest.ts"))); - } -} |