mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 04:39:10 +00:00
feat: deno test --filter (#4570)
This commit is contained in:
parent
ff0b32f81d
commit
c738797944
6 changed files with 325 additions and 289 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue