summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-03-14 23:23:53 +1100
committerGitHub <noreply@github.com>2020-03-14 13:23:53 +0100
commitba687125e7ce5574811aebdcb7eac6b4194e6def (patch)
tree5046c9fe12d7aaa06a02105e17f17f50402393b8
parentd6bbbdda7580d74d78fecae6c99b850bc90414c5 (diff)
Add support for jsx/tsx for deno test (#4369)
-rw-r--r--cli/test_runner.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/test_runner.rs b/cli/test_runner.rs
index eb1d42efd..92c15e251 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")));