From 4c2920ddd7729da2555728905c22aa2ece237758 Mon Sep 17 00:00:00 2001 From: tokiedokie Date: Sat, 19 Sep 2020 02:03:37 +0900 Subject: [PATCH] fix(cli/fmt): canonicalize files in current dir (#7508) --- cli/fmt.rs | 6 ++++-- cli/tests/integration_tests.rs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/cli/fmt.rs b/cli/fmt.rs index 16b90b1c76..2a88452905 100644 --- a/cli/fmt.rs +++ b/cli/fmt.rs @@ -236,8 +236,10 @@ pub fn collect_files( let mut target_files: Vec = vec![]; if files.is_empty() { - target_files - .extend(files_in_subtree(std::env::current_dir()?, is_supported)); + target_files.extend(files_in_subtree( + std::env::current_dir()?.canonicalize()?, + is_supported, + )); } else { for arg in files { let p = PathBuf::from(arg); diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 4eda0e8dd2..943e567998 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -3526,3 +3526,36 @@ fn rust_log() { assert!(output.status.success()); assert!(!output.stderr.is_empty()); } + +#[test] +fn lint_ignore_unexplicit_files() { + let output = util::deno_cmd() + .current_dir(util::root_path()) + .arg("lint") + .arg("--unstable") + .arg("--ignore=./") + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + assert!(output.stderr.is_empty()); +} + +#[test] +fn fmt_ignore_unexplicit_files() { + let output = util::deno_cmd() + .current_dir(util::root_path()) + .arg("fmt") + .arg("--unstable") + .arg("--check") + .arg("--ignore=./") + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + assert!(output.stderr.is_empty()); +}