diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index bfa9e88a9f2d01..a7178eddf6ca06 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -492,7 +492,7 @@ static void LoadEnvFile(const v8::FunctionCallbackInfo& args) { break; } case dotenv.ParseResult::FileError: { - env->ThrowUVException(UV_ENOENT, "Failed to load '%s'.", path.c_str()); + env->ThrowUVException(UV_ENOENT, "open", nullptr, path.c_str()); break; } default: diff --git a/test/parallel/test-process-load-env-file.js b/test/parallel/test-process-load-env-file.js index a07ba6771bb381..8aeaef42c97805 100644 --- a/test/parallel/test-process-load-env-file.js +++ b/test/parallel/test-process-load-env-file.js @@ -45,13 +45,13 @@ describe('process.loadEnvFile()', () => { it('should throw when file does not exist', async () => { assert.throws(() => { process.loadEnvFile(missingEnvFile); - }, { code: 'ENOENT' }); + }, { code: 'ENOENT', syscall: 'open', path: missingEnvFile }); }); it('should throw when `.env` does not exist', async () => { assert.throws(() => { process.loadEnvFile(); - }, { code: 'ENOENT' }); + }, { code: 'ENOENT', syscall: 'open', path: '.env' }); }); it('should check for permissions', async () => {