diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2023-11-02 02:21:13 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-01 15:21:13 +0000 |
commit | f8f4e776325efe0d8dd50207beecb425f0875999 (patch) | |
tree | f8781d719f6e980fe34dcf415e607e2826692573 /cli/tests/integration/repl_tests.rs | |
parent | 53248e9bb3123a1b684f3f9f744bb671dfa53bc1 (diff) |
feat(unstable): `deno run --env` (#20300)
This change adds the `--env=[FILE]` flag to the `run`, `compile`,
`eval`, `install` and `repl` subcommands. Environment variables set in
the CLI overwrite those defined in the `.env` file.
Diffstat (limited to 'cli/tests/integration/repl_tests.rs')
-rw-r--r-- | cli/tests/integration/repl_tests.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index 1cdc625b2..fe075d37c 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -1058,3 +1058,19 @@ fn closed_file_pre_load_does_not_occur() { assert_contains!(console.all_output(), "Skipping document preload.",); }); } + +#[test] +fn env_file() { + TestContext::default() + .new_command() + .args_vec([ + "repl", + "--env=env", + "--allow-env", + "--eval", + "console.log(Deno.env.get('FOO'))", + ]) + .with_pty(|console| { + assert_contains!(console.all_output(), "BAR",); + }); +} |