deno
1d36a124 - fix(ext/node): implement mock.getter, mock.setter, mockImplementation in node:test (#33755)

Commit
186 days ago
fix(ext/node): implement mock.getter, mock.setter, mockImplementation in node:test (#33755) Implements several missing mock APIs in the `node:test` polyfill: - `MockFunctionContext.mockImplementation()` — change the mock implementation after creation - `MockFunctionContext.mockImplementationOnce(impl, onCall?)` — set a one-time implementation for a specific call index - `mock.getter(object, name, impl?, options?)` — mock a getter on an object (was `notImplemented`) - `mock.setter(object, name, impl?, options?)` — mock a setter on an object (was `notImplemented`) - `findPropertyDescriptor()` — walk the prototype chain to find property descriptors, enabling mocking of inherited methods - `mock.method()` restore now uses `ObjectDefineProperty` instead of simple assignment, correctly restoring getters/setters/non-writable properties - Handle overloaded `mock.fn(options)` and `mock.fn(original, options)` call signatures matching Node.js API
Author
Parents
Loading