Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(jupyter): allow unstable flags #25483

Merged
merged 3 commits into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2461,7 +2461,7 @@ fn json_reference_subcommand() -> Command {
}

fn jupyter_subcommand() -> Command {
Command::new("jupyter")
command("jupyter", "Deno kernel for Jupyter notebooks", UnstableArgsConfig::ResolutionAndRuntime)
.arg(
Arg::new("install")
.long("install")
Expand All @@ -2484,7 +2484,6 @@ fn jupyter_subcommand() -> Command {
.value_parser(value_parser!(String))
.value_hint(ValueHint::FilePath)
.conflicts_with("install"))
.about("Deno kernel for Jupyter notebooks")
}

fn uninstall_subcommand() -> Command {
Expand Down Expand Up @@ -4584,6 +4583,8 @@ fn json_reference_parse(
}

fn jupyter_parse(flags: &mut Flags, matches: &mut ArgMatches) {
unstable_args_parse(flags, matches, UnstableArgsConfig::ResolutionAndRuntime);

let conn_file = matches.remove_one::<String>("conn");
let kernel = matches.get_flag("kernel");
let install = matches.get_flag("install");
Expand Down Expand Up @@ -10746,6 +10747,35 @@ mod tests {
.contains("Note: Permission flags can only be used in a global setting"));
}

#[test]
fn jupyter_unstable_flags() {
let r = flags_from_vec(svec![
"deno",
"jupyter",
"--unstable-ffi",
"--unstable-bare-node-builtins",
"--unstable-worker-options"
]);

assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Jupyter(JupyterFlags {
install: false,
kernel: false,
conn_file: None,
}),
unstable_config: UnstableConfig {
legacy_flag_enabled: false,
bare_node_builtins: true,
sloppy_imports: false,
features: svec!["ffi", "worker-options"],
},
..Flags::default()
}
);
}

#[test]
fn escape_and_split_commas_test() {
assert_eq!(escape_and_split_commas("foo".to_string()).unwrap(), ["foo"]);
Expand Down