Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Undocumented ```delete process.env.DEBUG``` when variable is empty

Đang mở
#845 3 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, node.js
Lĩnh vực
documentation

Hướng nghiên cứu

Start with the README and the behavior described when the debug package is required before dotenv loads. Document that an empty DEBUG environment variable may be removed, and include the proposed DEBUG=, workaround if appropriate. Done means the README clearly explains this behavior and its effect on later process.env.DEBUG checks.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug change-major

I would just like to point out to the fact that when required, debug package will remove the DEBUG env variable if empty.

I think it would be nice if this is mentioned in the readme, as I feel its a non obvious behavior.

The use case I noticed this on is:

command:

npm install dotenv
DEBUG= npx mocha --require bootstrap.js

files:

.env
DEBUG=*

bootstrap.js
console.log(process.env.DEBUG);
require('dotenv').config();
console.log(process.env.DEBUG);

output:

undefined // we lost the DEBUG env already
'*' // we get .env file DEBUG setting, but we should have gotten '', because dotenv never overrides set env variables (* actually after version 4 I believe)

problem:

mocha uses the debug package which deletes the env variable. Our user code in bootstrap.js then has no way of knowing if DEBUG was set to an empty string or not supplied. Therefore we get full debug info instead of none.

More general - any code used before using process.env.DEBUG might delete the env variable through just depending on the debug package.

solution

I propose we either not delete the DEBUG variable or have a section in documentation to explain and suggest maybe using DEBUG=, to disable debug logging.

Ngôn ngữ chính
JavaScript
Star
11.5k
Fork
993
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của debug-js/debug

Tất cả issue của debug-js/debug

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.