1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-21 23:04:45 -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:
Asher Gomez 2024-01-22 10:27:14 +11:00 committed by GitHub
parent 983c745d4f
commit b4990d1aa2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 9 deletions

View file

@ -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
);
}
}

View file

@ -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",
});

View file

@ -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 {

View file

@ -0,0 +1,2 @@
Warning The `--env` flag was used, but the dotenv file 'missing' was not found.
undefined

View file

@ -0,0 +1,4 @@
Warning The `--env` flag was used, but the dotenv file 'missing' was not found.
undefined
undefined
undefined