summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Lecoq <22963968+lowlighter@users.noreply.github.com>2024-10-03 08:28:38 -0400
committerGitHub <noreply@github.com>2024-10-03 12:28:38 +0000
commitda7edf1c0c92dc8b0b746b015da911d5820c64ba (patch)
tree373c51cc7dad6859f9814bb852cd0a58419cb062 /tests
parent19a9990f60a7d38137af6239cfa3a7573b883d7d (diff)
fix: don't prompt when using `Deno.permissions.request` with `--no-prompt` (#25811)
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/run_tests.rs16
-rw-r--r--tests/testdata/run/permission_request_no_prompt.ts1
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs
index 1e1d6ed61..b3ad15c81 100644
--- a/tests/integration/run_tests.rs
+++ b/tests/integration/run_tests.rs
@@ -3513,6 +3513,22 @@ itest!(no_prompt_flag {
});
#[test]
+fn permission_request_with_no_prompt() {
+ TestContext::default()
+ .new_command()
+ .env("NO_COLOR", "1")
+ .args_vec([
+ "run",
+ "--quiet",
+ "--no-prompt",
+ "run/permission_request_no_prompt.ts",
+ ])
+ .with_pty(|mut console| {
+ console.expect("PermissionStatus { state: \"denied\", onchange: null }");
+ });
+}
+
+#[test]
fn deno_no_prompt_environment_variable() {
let output = util::deno_cmd()
.current_dir(util::testdata_path())
diff --git a/tests/testdata/run/permission_request_no_prompt.ts b/tests/testdata/run/permission_request_no_prompt.ts
new file mode 100644
index 000000000..e33ffe3ce
--- /dev/null
+++ b/tests/testdata/run/permission_request_no_prompt.ts
@@ -0,0 +1 @@
+console.log(await Deno.permissions.request({ name: "read" }));