summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/integration/test_tests.rs5
-rw-r--r--cli/tests/testdata/test/filtered_out_only.out5
-rw-r--r--cli/tests/testdata/test/filtered_out_only.ts2
-rw-r--r--cli/tools/test/mod.rs10
4 files changed, 17 insertions, 5 deletions
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs
index f84c2a560..042e84078 100644
--- a/cli/tests/integration/test_tests.rs
+++ b/cli/tests/integration/test_tests.rs
@@ -91,6 +91,11 @@ itest!(test_with_malformed_config {
output: "test/collect_with_malformed_config.out",
});
+itest!(test_filtered_out_only {
+ args: "test --quiet --filter foo test/filtered_out_only.ts",
+ output: "test/filtered_out_only.out",
+});
+
itest!(parallel_flag {
args: "test test/short-pass.ts --parallel",
exit_code: 0,
diff --git a/cli/tests/testdata/test/filtered_out_only.out b/cli/tests/testdata/test/filtered_out_only.out
new file mode 100644
index 000000000..337893848
--- /dev/null
+++ b/cli/tests/testdata/test/filtered_out_only.out
@@ -0,0 +1,5 @@
+running 1 test from ./test/filtered_out_only.ts
+foo ... ok ([WILDCARD])
+
+ok | 1 passed | 0 failed | 1 filtered out ([WILDCARD])
+
diff --git a/cli/tests/testdata/test/filtered_out_only.ts b/cli/tests/testdata/test/filtered_out_only.ts
new file mode 100644
index 000000000..bda301a43
--- /dev/null
+++ b/cli/tests/testdata/test/filtered_out_only.ts
@@ -0,0 +1,2 @@
+Deno.test("foo", () => {});
+Deno.test("bar", { only: true }, () => {});
diff --git a/cli/tools/test/mod.rs b/cli/tools/test/mod.rs
index 7ab74ff7c..15f8d2597 100644
--- a/cli/tools/test/mod.rs
+++ b/cli/tools/test/mod.rs
@@ -464,14 +464,14 @@ pub async fn test_specifier(
std::mem::take(&mut state.borrow_mut::<ops::testing::TestContainer>().0)
};
let unfiltered = tests.len();
- let (only, no_only): (Vec<_>, Vec<_>) =
- tests.into_iter().partition(|(d, _)| d.only);
- let used_only = !only.is_empty();
- let tests = if used_only { only } else { no_only };
- let mut tests = tests
+ let tests = tests
.into_iter()
.filter(|(d, _)| options.filter.includes(&d.name))
.collect::<Vec<_>>();
+ let (only, no_only): (Vec<_>, Vec<_>) =
+ tests.into_iter().partition(|(d, _)| d.only);
+ let used_only = !only.is_empty();
+ let mut tests = if used_only { only } else { no_only };
if let Some(seed) = options.shuffle {
tests.shuffle(&mut SmallRng::seed_from_u64(seed));
}