feat: deno test --filter (#4570)

This commit is contained in:
Ryan Dahl 2020-04-02 09:26:40 -04:00 committed by GitHub
parent ff0b32f81d
commit c738797944
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 325 additions and 289 deletions

View file

@ -445,6 +445,7 @@ async fn test_command(
include: Option<Vec<String>>,
fail_fast: bool,
allow_none: bool,
filter: Option<String>,
) -> Result<(), ErrBox> {
let global_state = GlobalState::new(flags.clone())?;
let cwd = std::env::current_dir().expect("No current directory");
@ -462,7 +463,8 @@ async fn test_command(
let test_file_path = cwd.join(".deno.test.ts");
let test_file_url =
Url::from_file_path(&test_file_path).expect("Should be valid file url");
let test_file = test_runner::render_test_file(test_modules, fail_fast);
let test_file =
test_runner::render_test_file(test_modules, fail_fast, filter);
let main_module =
ModuleSpecifier::resolve_url(&test_file_url.to_string()).unwrap();
let mut worker =
@ -545,7 +547,10 @@ pub fn main() {
fail_fast,
include,
allow_none,
} => test_command(flags, include, fail_fast, allow_none).boxed_local(),
filter,
} => {
test_command(flags, include, fail_fast, allow_none, filter).boxed_local()
}
DenoSubcommand::Completions { buf } => {
if let Err(e) = write_to_stdout_ignore_sigpipe(&buf) {
eprintln!("{}", e);