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

Function copyOriginalStaticProperties

packages/spy/src/index.ts:609–621  ·  view source on GitHub ↗
(mock: Mock<Procedure | Constructable>, original: Procedure | Constructable)

Source from the content-addressed store, hash-verified

607}
608
609function copyOriginalStaticProperties(mock: Mock<Procedure | Constructable>, original: Procedure | Constructable) {
610 const { properties, descriptors } = getAllProperties(original)
611
612 for (const key of properties) {
613 const descriptor = descriptors[key]!
614 const mockDescriptor = getDescriptor(mock, key)
615 if (mockDescriptor) {
616 continue
617 }
618
619 Object.defineProperty(mock, key, descriptor)
620 }
621}
622
623const ignoreProperties = new Set<string | symbol>([
624 'length',

Callers 1

createMockFunction · 0.85

Calls 2

getAllPropertiesFunction · 0.85
getDescriptorFunction · 0.85

Tested by

no test coverage detected