MCPcopy
hub / github.com/vitest-dev/vitest / restore

Function restore

packages/spy/src/index.ts:358–370  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

356 }
357
358 const restore = () => {
359 // if method is defined on the prototype, we can just remove it from
360 // the current object instead of redefining a copy of it
361 if (originalDescriptorObject !== object) {
362 Reflect.deleteProperty(object, key)
363 }
364 else if (originalDescriptor && !original) {
365 Object.defineProperty(object, key, originalDescriptor)
366 }
367 else {
368 reassign(original)
369 }
370 }
371
372 const mock = createMockInstance({
373 restore,

Callers 2

createMockInstanceFunction · 0.85
restoreAllMocksFunction · 0.85

Calls 2

reassignFunction · 0.85
deletePropertyMethod · 0.45

Tested by

no test coverage detected