summaryrefslogtreecommitdiff
path: root/cli/test_runner.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/test_runner.rs')
-rw-r--r--cli/test_runner.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/cli/test_runner.rs b/cli/test_runner.rs
index c3482560b..3f94be69a 100644
--- a/cli/test_runner.rs
+++ b/cli/test_runner.rs
@@ -61,15 +61,24 @@ pub fn prepare_test_modules_urls(
Ok(prepared)
}
-pub fn render_test_file(modules: Vec<Url>, fail_fast: bool) -> String {
+pub fn render_test_file(
+ modules: Vec<Url>,
+ fail_fast: bool,
+ filter: Option<String>,
+) -> String {
let mut test_file = "".to_string();
for module in modules {
test_file.push_str(&format!("import \"{}\";\n", module.to_string()));
}
- let run_tests_cmd =
- format!("Deno.runTests({{ failFast: {} }});\n", fail_fast);
+ let options = if let Some(filter) = filter {
+ json!({ "failFast": fail_fast, "filter": filter })
+ } else {
+ json!({ "failFast": fail_fast })
+ };
+
+ let run_tests_cmd = format!("Deno.runTests({});\n", options);
test_file.push_str(&run_tests_cmd);
test_file