diff options
author | 2023-07-02 13:12:31 -0400 | |
---|---|---|
committer | 2023-07-02 10:12:31 -0700 | |
commit | 4cbda049e97b2e1049cd2c4c93a617a54931b220 (patch) | |
tree | ac08d2a041af5a5f6fc34f9d2343e7071a8fcd3d /test | |
parent | 69396aae012b42a277104b828646f7b96f680af7 (diff) | |
download | bun-4cbda049e97b2e1049cd2c4c93a617a54931b220.tar.gz bun-4cbda049e97b2e1049cd2c4c93a617a54931b220.tar.zst bun-4cbda049e97b2e1049cd2c4c93a617a54931b220.zip |
fix zero length env var (#3496)
Diffstat (limited to 'test')
-rw-r--r-- | test/cli/run/env.test.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/cli/run/env.test.ts b/test/cli/run/env.test.ts index 0cab610a5..e6ee99dd2 100644 --- a/test/cli/run/env.test.ts +++ b/test/cli/run/env.test.ts @@ -308,3 +308,13 @@ test(".env Windows-style newline (issue #3042)", () => { const { stdout } = bunRun(`${dir}/index.ts`); expect(stdout).toBe("|bar\n\nbaz|moo"); }); + +test(".env with zero length strings", () => { + const dir = tempDirWithFiles("dotenv-issue-zerolength", { + ".env": "FOO=''\n", + "index.ts": + "function i(a){return a}\nconsole.log([process.env.FOO,i(process.env).FOO,process.env.FOO.length,i(process.env).FOO.length].join('|'));", + }); + const { stdout } = bunRun(`${dir}/index.ts`); + expect(stdout).toBe("||0|0"); +}); |