mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 05:12:29 +00:00
This commit fixes a major Node.js compatibility issue where Bun was not converting non-string values to strings when assigned to process.env properties. **Issues Fixed:** - process.env.VAR = undefined now converts to string "undefined" (was: undefined) - process.env.VAR = null now converts to string "null" (was: null object) - process.env.VAR = 123 now converts to string "123" (was: number 123) - process.env.VAR = true now converts to string "true" (was: boolean true) - All other value types now get converted using String() conversion - process.env.VAR = Symbol() now throws TypeError (was: silent undefined) **Changes:** - Modified jsSetterEnvironmentVariable in JSEnvironmentVariableMap.cpp to convert all values to strings - Added Bun__setEnvValue function to properly set environment variables in Bun's internal map - Added comprehensive tests covering all value types and edge cases - Updated Node.js compatibility test for process.env undefined assignment **Node.js Compatibility:** This change ensures Bun matches Node.js behavior exactly where all assignments to process.env properties are automatically converted to strings, with the sole exception of Symbol values which throw a TypeError. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>