Skip to content

Commit

Permalink
src: make dotenv return warning when not found
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed May 27, 2024
1 parent 8e9686d commit 23bc674
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ static ExitCode InitializeNodeWithArgsInternal(
errors->push_back(file_path + ": invalid format");
break;
case Dotenv::ParseResult::FileError:
errors->push_back(file_path + ": not found");
fprintf(stderr, "Warning: Requested .env file not found\n\n");
break;
default:
UNREACHABLE();
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-dotenv-edge-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ describe('.env supports edge cases', () => {
[ '--env-file=.env', '--eval', code ],
{ cwd: __dirname },
);
assert.notStrictEqual(child.stderr.toString(), '');
assert.strictEqual(child.code, 9);
assert.ok(child.stderr.includes('Requested .env file not found'));
assert.strictEqual(child.code, 0);
});

it('should not override existing environment variables but introduce new vars', async () => {
Expand Down

0 comments on commit 23bc674

Please sign in to comment.