Files
bun.sh/test/js/node
Claude Bot dd5a5a5f32 Fix process.env string conversion to match Node.js behavior
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>
2025-08-15 07:06:19 +00:00
..
2025-08-04 19:42:40 -07:00