From 0da4779b178a0c97925c1ef5589d0f24a37f4501 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 30 Jul 2020 21:39:08 +0530 Subject: feat(unstable): add "--ignore" flag to deno fmt (#6890) --- cli/tests/integration_tests.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'cli/tests') diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index ea76fe23b..89b5cc21e 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -352,6 +352,20 @@ fn fmt_test() { let badly_formatted_str = badly_formatted.to_str().unwrap(); std::fs::copy(&badly_formatted_original, &badly_formatted) .expect("Failed to copy file"); + // First, check formatting by ignoring the badly formatted file. + let status = util::deno_cmd() + .current_dir(util::root_path()) + .arg("fmt") + .arg(format!("--ignore={}", badly_formatted_str)) + .arg("--unstable") + .arg("--check") + .arg(badly_formatted_str) + .spawn() + .expect("Failed to spawn script") + .wait() + .expect("Failed to wait for child process"); + assert!(status.success()); + // Check without ignore. let status = util::deno_cmd() .current_dir(util::root_path()) .arg("fmt") @@ -362,6 +376,7 @@ fn fmt_test() { .wait() .expect("Failed to wait for child process"); assert!(!status.success()); + // Format the source file. let status = util::deno_cmd() .current_dir(util::root_path()) .arg("fmt") -- cgit v1.2.3