summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2021-07-23 16:31:16 +0200
committerGitHub <noreply@github.com>2021-07-23 16:31:16 +0200
commit28f2f02b7a72154458762c0c152fe598c489e4c7 (patch)
tree356d40397cf3bf5bb5b46519df5ca28b6269a63c
parent8b34f07bb000a16b60b119ee24f5c0b4a5f7f937 (diff)
feat: add --enable-testing-features-do-not-use (#11499)
This flag does nothing yet. It is added in preparation for the addition of classic workers.
-rw-r--r--cli/flags.rs75
-rw-r--r--cli/tools/standalone.rs9
2 files changed, 75 insertions, 9 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index f75aa5b22..69df8f6fe 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -137,22 +137,23 @@ pub struct Flags {
pub allow_read: Option<Vec<PathBuf>>,
pub allow_run: Option<Vec<String>>,
pub allow_write: Option<Vec<PathBuf>>,
- pub location: Option<Url>,
- pub cache_blocklist: Vec<String>,
pub ca_file: Option<String>,
+ pub cache_blocklist: Vec<String>,
pub cached_only: bool,
pub config_path: Option<String>,
pub coverage_dir: Option<String>,
+ pub enable_testing_features: bool,
pub ignore: Vec<PathBuf>,
pub import_map_path: Option<String>,
- pub inspect: Option<SocketAddr>,
pub inspect_brk: Option<SocketAddr>,
- pub lock: Option<PathBuf>,
+ pub inspect: Option<SocketAddr>,
+ pub location: Option<Url>,
pub lock_write: bool,
+ pub lock: Option<PathBuf>,
pub log_level: Option<Level>,
pub no_check: bool,
- pub prompt: bool,
pub no_remote: bool,
+ pub prompt: bool,
pub reload: bool,
pub repl: bool,
pub seed: Option<u64>,
@@ -1267,6 +1268,7 @@ fn runtime_args<'a, 'b>(
.arg(location_arg())
.arg(v8_flags_arg())
.arg(seed_arg())
+ .arg(enable_testing_features_arg())
}
fn inspect_args<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> {
@@ -1368,6 +1370,13 @@ fn location_arg<'a, 'b>() -> Arg<'a, 'b> {
.help("Value of 'globalThis.location' used by some web APIs")
}
+fn enable_testing_features_arg<'a, 'b>() -> Arg<'a, 'b> {
+ Arg::with_name("enable-testing-features-do-not-use")
+ .long("enable-testing-features-do-not-use")
+ .help("INTERNAL: Enable internal features used during integration testing")
+ .hidden(true)
+}
+
fn v8_flags_arg<'a, 'b>() -> Arg<'a, 'b> {
Arg::with_name("v8-flags")
.long("v8-flags")
@@ -1902,6 +1911,7 @@ fn runtime_args_parse(
v8_flags_arg_parse(flags, matches);
seed_arg_parse(flags, matches);
inspect_arg_parse(flags, matches);
+ enable_testing_features_arg_parse(flags, matches);
}
fn inspect_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1948,6 +1958,15 @@ fn ca_file_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
flags.ca_file = matches.value_of("cert").map(ToOwned::to_owned);
}
+fn enable_testing_features_arg_parse(
+ flags: &mut Flags,
+ matches: &clap::ArgMatches,
+) {
+ if matches.is_present("enable-testing-features-do-not-use") {
+ flags.enable_testing_features = true
+ }
+}
+
fn cached_only_arg_parse(flags: &mut Flags, matches: &ArgMatches) {
if matches.is_present("cached-only") {
flags.cached_only = true;
@@ -3453,6 +3472,26 @@ mod tests {
}
#[test]
+ fn run_with_enable_testing_features() {
+ let r = flags_from_vec(svec![
+ "deno",
+ "run",
+ "--enable-testing-features-do-not-use",
+ "script.ts"
+ ]);
+ assert_eq!(
+ r.unwrap(),
+ Flags {
+ subcommand: DenoSubcommand::Run {
+ script: "script.ts".to_string(),
+ },
+ enable_testing_features: true,
+ ..Flags::default()
+ }
+ );
+ }
+
+ #[test]
fn test_with_fail_fast() {
let r = flags_from_vec(svec!["deno", "test", "--fail-fast=3"]);
assert_eq!(
@@ -3475,6 +3514,32 @@ mod tests {
}
#[test]
+ fn test_with_enable_testing_features() {
+ let r = flags_from_vec(svec![
+ "deno",
+ "test",
+ "--enable-testing-features-do-not-use"
+ ]);
+ assert_eq!(
+ r.unwrap(),
+ Flags {
+ subcommand: DenoSubcommand::Test {
+ no_run: false,
+ doc: false,
+ fail_fast: None,
+ filter: None,
+ allow_none: false,
+ quiet: false,
+ shuffle: None,
+ include: None,
+ concurrent_jobs: 1,
+ },
+ enable_testing_features: true,
+ ..Flags::default()
+ }
+ );
+ }
+ #[test]
fn test_watch() {
let r = flags_from_vec(svec!["deno", "test", "--watch"]);
assert_eq!(
diff --git a/cli/tools/standalone.rs b/cli/tools/standalone.rs
index ab093eec1..259c61222 100644
--- a/cli/tools/standalone.rs
+++ b/cli/tools/standalone.rs
@@ -205,22 +205,23 @@ pub fn compile_to_runtime_flags(
allow_read: flags.allow_read,
allow_run: flags.allow_run,
allow_write: flags.allow_write,
- cache_blocklist: vec![],
ca_file: flags.ca_file,
+ cache_blocklist: vec![],
cached_only: false,
config_path: None,
coverage_dir: flags.coverage_dir,
+ enable_testing_features: false,
ignore: vec![],
import_map_path: None,
- inspect: None,
inspect_brk: None,
+ inspect: None,
location: flags.location,
- lock: None,
lock_write: false,
+ lock: None,
log_level: flags.log_level,
no_check: false,
- prompt: flags.prompt,
no_remote: false,
+ prompt: flags.prompt,
reload: false,
repl: false,
seed: flags.seed,