From ba687125e7ce5574811aebdcb7eac6b4194e6def Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Sat, 14 Mar 2020 23:23:53 +1100 Subject: [PATCH] Add support for jsx/tsx for deno test (#4369) --- cli/test_runner.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cli/test_runner.rs b/cli/test_runner.rs index eb1d42efd4..92c15e2513 100644 --- a/cli/test_runner.rs +++ b/cli/test_runner.rs @@ -13,11 +13,17 @@ fn is_supported(p: &Path) -> bool { 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.jsx") || basename.ends_with(".test.ts") + || basename.ends_with(".test.tsx") || basename.ends_with(".test.js") + || basename.ends_with(".test.jsx") || basename == "test.ts" + || basename == "test.tsx" || basename == "test.js" + || basename == "test.jsx" } else { false } @@ -108,11 +114,17 @@ mod tests { #[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")));