watch: fix interaction with multiple env files · nodejs/node@d64795b · GitHub
Skip to content

Commit d64795b

Browse files
marco-ippolitoaduh95
authored andcommitted
watch: fix interaction with multiple env files
PR-URL: #60605 Fixes: #60599 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 727560a commit d64795b

4 files changed

Lines changed: 43 additions & 5 deletions

File tree

lib/internal/main/watch_mode.js

Lines changed: 6 additions & 3 deletions

src/node_options.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ class EnvironmentOptions : public Options {
185185
#endif // HAVE_INSPECTOR
186186
std::string redirect_warnings;
187187
std::string diagnostic_dir;
188-
std::string env_file;
189-
std::string optional_env_file;
188+
std::vector<std::string> env_file;
189+
std::vector<std::string> optional_env_file;
190190
bool has_env_file_string = false;
191191
bool test_runner = false;
192192
uint64_t test_runner_concurrency = 0;

test/parallel/test-dotenv-edge-cases.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ describe('.env supports edge cases', () => {
3939
})));
4040
});
4141

42+
it('should not support comma-separated env files', async () => {
43+
const code = 'assert.strictEqual(1, 1)';
44+
const child = await common.spawnPromisified(
45+
process.execPath,
46+
[`--env-file=${validEnvFilePath},${nodeOptionsEnvFilePath}`, '--eval', code],
47+
{ cwd: __dirname },
48+
);
49+
assert.notStrictEqual(child.stderr, '');
50+
assert.strictEqual(child.code, 9);
51+
});
52+
4253
it('supports absolute paths', async () => {
4354
const code = `
4455
assert.strictEqual(process.env.BASIC, 'basic');

test/sequential/test-watch-mode.mjs

Lines changed: 24 additions & 0 deletions

0 commit comments

Comments
 (0)