From 18a63dd977ade20e17d41c08acbefde6eada8572 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 30 Nov 2021 09:23:30 +1100 Subject: feat: add `--no-check=remote` flag (#12766) Closes #11970 --- cli/tools/installer.rs | 12 +++++++++--- cli/tools/standalone.rs | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'cli/tools') diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index 18d2d20e7..a426fea0f 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -1,4 +1,6 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +use crate::flags::CheckFlag; use crate::flags::Flags; use crate::fs_util::canonicalize_path; use deno_core::error::generic_error; @@ -267,8 +269,12 @@ pub fn install( } } - if flags.no_check { - executable_args.push("--no-check".to_string()); + // we should avoid a default branch here to ensure we continue to cover any + // changes to this flag. + match flags.check { + CheckFlag::All => (), + CheckFlag::None => executable_args.push("--no-check".to_string()), + CheckFlag::Local => executable_args.push("--no-check=remote".to_string()), } if flags.unstable { @@ -687,7 +693,7 @@ mod tests { Flags { allow_net: Some(vec![]), allow_read: Some(vec![]), - no_check: true, + check: CheckFlag::None, log_level: Some(Level::Error), ..Flags::default() }, diff --git a/cli/tools/standalone.rs b/cli/tools/standalone.rs index 5dd6f23ad..d8ec14dc6 100644 --- a/cli/tools/standalone.rs +++ b/cli/tools/standalone.rs @@ -1,6 +1,7 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. use crate::deno_dir::DenoDir; +use crate::flags::CheckFlag; use crate::flags::DenoSubcommand; use crate::flags::Flags; use crate::flags::RunFlags; @@ -226,7 +227,7 @@ pub fn compile_to_runtime_flags( lock_write: false, lock: None, log_level: flags.log_level, - no_check: false, + check: CheckFlag::All, compat: flags.compat, unsafely_ignore_certificate_errors: flags .unsafely_ignore_certificate_errors, -- cgit v1.2.3