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/eval_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/eval_tests.rs')
-rw-r--r-- | cli/tests/integration/eval_tests.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/tests/integration/eval_tests.rs b/cli/tests/integration/eval_tests.rs index df2362c7f..99a0d674f 100644 --- a/cli/tests/integration/eval_tests.rs +++ b/cli/tests/integration/eval_tests.rs @@ -77,3 +77,16 @@ itest!(check_local_by_default2 { output: "eval/check_local_by_default2.out", http_server: true, }); + +itest!(env_file { + args: "eval --env=env console.log(Deno.env.get(\"ANOTHER_FOO\"))", + output_str: Some("ANOTHER_BAR\n"), +}); + +itest!(env_file_missing { + args: "eval --env=missing console.log(Deno.env.get(\"ANOTHER_FOO\"))", + output_str: Some( + "error: Unable to load 'missing' environment variable file\n" + ), + exit_code: 1, +}); |