From 66fbdd2ed4b5ecab8a51278cd76bce7adedb4fc2 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Mon, 18 Apr 2022 20:08:30 +0100 Subject: feat: Add DENO_NO_PROMPT variable (#14209) This commit adds support for "DENO_NO_PROMPT" env variable, that can be used instead of "--no-prompt" flag to completely disable permission prompts. --- cli/tests/integration/bench_tests.rs | 5 +++-- cli/tests/integration/run_tests.rs | 20 ++++++++++++++++++++ cli/tests/integration/test_tests.rs | 4 ++-- 3 files changed, 25 insertions(+), 4 deletions(-) (limited to 'cli/tests/integration') diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs index 7b4fbb0a5..e889a8224 100644 --- a/cli/tests/integration/bench_tests.rs +++ b/cli/tests/integration/bench_tests.rs @@ -130,13 +130,14 @@ itest!(filter { }); itest!(no_prompt_by_default { - args: "bench --unstable bench/no_prompt_by_default.ts", + args: "bench --quiet --unstable bench/no_prompt_by_default.ts", exit_code: 1, output: "bench/no_prompt_by_default.out", }); itest!(no_prompt_with_denied_perms { - args: "bench --unstable --allow-read bench/no_prompt_with_denied_perms.ts", + args: + "bench --quiet --unstable --allow-read bench/no_prompt_with_denied_perms.ts", exit_code: 1, output: "bench/no_prompt_with_denied_perms.out", }); diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index 0953e7239..b99ab2890 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -2733,3 +2733,23 @@ itest!(js_root_with_ts_check { output: "js_root_with_ts_check.js.out", exit_code: 1, }); + +itest!(no_prompt_flag { + args: "run --quiet --unstable --no-prompt no_prompt.ts", + output_str: Some(""), +}); + +#[test] +fn deno_no_prompt_environment_variable() { + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("run") + .arg("--unstable") + .arg("no_prompt.ts") + .env("DENO_NO_PROMPT", "1") + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); +} diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs index bac50f16d..3e2df9113 100644 --- a/cli/tests/integration/test_tests.rs +++ b/cli/tests/integration/test_tests.rs @@ -288,13 +288,13 @@ itest!(steps_output_within { }); itest!(no_prompt_by_default { - args: "test test/no_prompt_by_default.ts", + args: "test --quiet test/no_prompt_by_default.ts", exit_code: 1, output: "test/no_prompt_by_default.out", }); itest!(no_prompt_with_denied_perms { - args: "test --allow-read test/no_prompt_with_denied_perms.ts", + args: "test --quiet --allow-read test/no_prompt_with_denied_perms.ts", exit_code: 1, output: "test/no_prompt_with_denied_perms.out", }); -- cgit v1.2.3