mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
refactor: don't error when .env
is not present (#21879)
Uses similar format to when the latest version of std is implicitly being used. Closes #21788
This commit is contained in:
parent
983c745d4f
commit
b4990d1aa2
5 changed files with 13 additions and 9 deletions
|
@ -725,7 +725,11 @@ impl CliOptions {
|
|||
|
||||
if let Some(env_file_name) = &flags.env_file {
|
||||
if (from_filename(env_file_name)).is_err() {
|
||||
bail!("Unable to load '{env_file_name}' environment variable file")
|
||||
log::info!(
|
||||
"{} The `--env` flag was used, but the dotenv file '{}' was not found.",
|
||||
colors::yellow("Warning"),
|
||||
env_file_name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,8 +85,5 @@ itest!(env_file {
|
|||
|
||||
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,
|
||||
output: "eval/env_file_missing.out",
|
||||
});
|
||||
|
|
|
@ -758,10 +758,7 @@ itest!(env_file {
|
|||
|
||||
itest!(env_file_missing {
|
||||
args: "run --env=missing --allow-env run/env_file.ts",
|
||||
output_str: Some(
|
||||
"error: Unable to load 'missing' environment variable file\n"
|
||||
),
|
||||
exit_code: 1,
|
||||
output: "run/env_file_missing.out",
|
||||
});
|
||||
|
||||
itest!(_091_use_define_for_class_fields {
|
||||
|
|
2
cli/tests/testdata/eval/env_file_missing.out
vendored
Normal file
2
cli/tests/testdata/eval/env_file_missing.out
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
Warning The `--env` flag was used, but the dotenv file 'missing' was not found.
|
||||
undefined
|
4
cli/tests/testdata/run/env_file_missing.out
vendored
Normal file
4
cli/tests/testdata/run/env_file_missing.out
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
Warning The `--env` flag was used, but the dotenv file 'missing' was not found.
|
||||
undefined
|
||||
undefined
|
||||
undefined
|
Loading…
Reference in a new issue