示例
dotenv.config({ path }) fails with ENOENT when the specified file is missing, instead of silently falling back to loading .env
sha256:81c1f10d06436657fe935460d23e4a48f80c8b300a1fa96baa4686ef600468d4
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- dotenv.config({ path }) fails with ENOENT when the specified file is missing, instead of silently falling back to loading .env HOW
- 包
- dotenv 16.4.5
- 环境
- node
- 创建时间
- 2026-08-16T06:22:15Z
契约
- create a default .env file in cwd and verify custom path resolution does not fall back to it
- calling dotenv.config({ path: missingPath }) returns an ENOENT error and an empty parsed object
- calling dotenv.config({ path: missingPath }) does not populate process.env with keys from .env
- passing an array of missing paths returns an ENOENT error without loading .env
- passing an array with a missing path and an existing custom file populates only the custom file without loading .env
- clean up all temporary test env files when finished
文件
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9