Version
26.3.0
Platform
Darwin hostname 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:38:00 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T8103 arm64
Subsystem
No response
What steps will reproduce the bug?
Run a script below
import { createContext, Script } from "node:vm";
const context = {};
createContext(context);
new Script(
`globalThis.foo = 0; Object.defineProperty(globalThis, "foo", { enumerable: false });`,
).runInContext(context);
console.log(context.foo);
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
the script should print "0", because Object.defineProperty without value option should keep the original value:
globalThis.foo = 0;
Object.defineProperty(globalThis, "foo", { enumerable: false });
console.log(globalThis.foo); // 0
What do you see instead?
the script prints "undefined"
Additional information
The script works as intended in v26.2.0.
Version
26.3.0
Platform
Subsystem
No response
What steps will reproduce the bug?
Run a script below
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
the script should print "0", because
Object.definePropertywithoutvalueoption should keep the original value:What do you see instead?
the script prints "undefined"
Additional information
The script works as intended in v26.2.0.